#7365 StimPlanModel: Add optional table for inital and current pressure data.

This commit is contained in:
Kristian Bendiksen 2021-02-15 16:03:22 +01:00
parent e7d7a40251
commit 77d02e67da
15 changed files with 742 additions and 8 deletions

View File

@ -85,6 +85,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RicThemeColorEditorFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewVfpPlotFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewCustomObjectiveFunctionFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewCustomObjectiveFunctionWeightFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewPressureTableItemFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicDeletePressureTableItemFeature.h
)
@ -174,6 +176,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RicThemeColorEditorFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewVfpPlotFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewCustomObjectiveFunctionFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewCustomObjectiveFunctionWeightFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewPressureTableItemFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicDeletePressureTableItemFeature.cpp
)
if(Qt5Charts_FOUND)

View File

@ -0,0 +1,66 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicDeletePressureTableItemFeature.h"
#include "RimPressureTable.h"
#include "RimPressureTableItem.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicDeletePressureTableItemFeature, "RicDeletePressureTableItemFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicDeletePressureTableItemFeature::isCommandEnabled()
{
std::vector<RimPressureTableItem*> objects;
caf::SelectionManager::instance()->objectsByType( &objects, caf::SelectionManager::FIRST_LEVEL );
return !objects.empty();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicDeletePressureTableItemFeature::onActionTriggered( bool isChecked )
{
std::vector<RimPressureTableItem*> items;
caf::SelectionManager::instance()->objectsByType( &items, caf::SelectionManager::FIRST_LEVEL );
if ( !items.empty() )
{
RimPressureTable* pressureTable = nullptr;
items[0]->firstAncestorOrThisOfTypeAsserted( pressureTable );
for ( RimPressureTableItem* attributeToDelete : items )
{
pressureTable->deleteItem( attributeToDelete );
}
pressureTable->updateAllRequiredEditors();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicDeletePressureTableItemFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Delete" );
actionToSetup->setIcon( QIcon( ":/Erase.svg" ) );
applyShortcutWithHintToAction( actionToSetup, QKeySequence::Delete );
}

View File

@ -0,0 +1,35 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicDeletePressureTableItemFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@ -0,0 +1,57 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicNewPressureTableItemFeature.h"
#include "RimPressureTable.h"
#include "RimPressureTableItem.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicNewPressureTableItemFeature, "RicNewPressureTableItemFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewPressureTableItemFeature::isCommandEnabled()
{
return caf::SelectionManager::instance()->selectedItemOfType<RimPressureTable>() != nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewPressureTableItemFeature::onActionTriggered( bool isChecked )
{
RimPressureTable* pressureTable = caf::SelectionManager::instance()->selectedItemOfType<RimPressureTable>();
if ( pressureTable )
{
RimPressureTableItem* attribute = new RimPressureTableItem;
pressureTable->insertItem( nullptr, attribute );
pressureTable->updateAllRequiredEditors();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewPressureTableItemFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Append New Item" );
}

View File

@ -0,0 +1,35 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicNewPressureTableItemFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@ -101,6 +101,7 @@
#include "RimPlotDataFilterCollection.h"
#include "RimPlotDataFilterItem.h"
#include "RimPltPlotCollection.h"
#include "RimPressureTable.h"
#include "RimProject.h"
#include "RimRftPlotCollection.h"
#include "RimSaturationPressurePlotCollection.h"
@ -434,6 +435,10 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
menuBuilder << "RicNewStimPlanModelPlotFeature";
menuBuilder << "RicExportStimPlanModelToFileFeature";
}
else if ( dynamic_cast<RimPressureTable*>( firstUiItem ) )
{
menuBuilder << "RicNewPressureTableItemFeature";
}
else if ( dynamic_cast<RimStimPlanModelCollection*>( firstUiItem ) )
{
menuBuilder << "RicNewStimPlanModelFeature";

View File

@ -21,6 +21,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RimElasticPropertyScalingCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimFaciesProperties.h
${CMAKE_CURRENT_LIST_DIR}/RimNonNetLayers.h
${CMAKE_CURRENT_LIST_DIR}/RimFaciesInitialPressureConfig.h
${CMAKE_CURRENT_LIST_DIR}/RimPressureTableItem.h
${CMAKE_CURRENT_LIST_DIR}/RimPressureTable.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -43,6 +45,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RimElasticPropertyScalingCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimFaciesProperties.cpp
${CMAKE_CURRENT_LIST_DIR}/RimNonNetLayers.cpp
${CMAKE_CURRENT_LIST_DIR}/RimFaciesInitialPressureConfig.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPressureTableItem.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPressureTable.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -0,0 +1,192 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- 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 "RimPressureTable.h"
#include "RiaStimPlanModelDefines.h"
#include "RimPressureTableItem.h"
#include "cafCmdFeatureMenuBuilder.h"
#include "cafPdmUiTableViewEditor.h"
#include "cafPdmUiTreeOrdering.h"
CAF_PDM_SOURCE_INIT( RimPressureTable, "PressureTable" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPressureTable::RimPressureTable()
: changed( this )
{
CAF_PDM_InitObject( "Pressure Table", "", "", "" );
CAF_PDM_InitField( &m_useForInitialPressure, "UseForInitialPressure", false, "Use For Initial Pressure", "", "", "" );
CAF_PDM_InitField( &m_useForPressure, "UseForPressure", false, "Use For Pressure", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_pressureTableItems, "Items", "Pressure Table Items", "", "", "" );
m_pressureTableItems.uiCapability()->setUiEditorTypeName( caf::PdmUiTableViewEditor::uiEditorTypeName() );
m_pressureTableItems.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
m_pressureTableItems.uiCapability()->setCustomContextMenuEnabled( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPressureTable::~RimPressureTable()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimPressureTableItem*> RimPressureTable::items() const
{
std::vector<RimPressureTableItem*> attrs;
for ( auto attr : m_pressureTableItems )
{
attrs.push_back( attr.p() );
}
return attrs;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPressureTable::insertItem( RimPressureTableItem* insertBefore, RimPressureTableItem* item )
{
size_t index = m_pressureTableItems.index( insertBefore );
item->changed.connect( this, &RimPressureTable::onTableChanged );
if ( index < m_pressureTableItems.size() )
m_pressureTableItems.insert( index, item );
else
m_pressureTableItems.push_back( item );
onTableChanged();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPressureTable::deleteItem( RimPressureTableItem* itemToDelete )
{
m_pressureTableItems.removeChildObject( itemToDelete );
delete itemToDelete;
onTableChanged();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPressureTable::deleteAllItems()
{
m_pressureTableItems.deleteAllChildObjects();
onTableChanged();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPressureTable::defineCustomContextMenu( const caf::PdmFieldHandle* fieldNeedingMenu,
QMenu* menu,
QWidget* fieldEditorWidget )
{
caf::CmdFeatureMenuBuilder menuBuilder;
menuBuilder << "RicNewPressureTableItemFeature";
menuBuilder << "Separator";
menuBuilder << "RicDeletePressureTableItemFeature";
menuBuilder.appendToMenu( menu );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPressureTable::defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute )
{
if ( field == &m_pressureTableItems )
{
auto tvAttribute = dynamic_cast<caf::PdmUiTableViewEditorAttribute*>( attribute );
if ( tvAttribute )
{
tvAttribute->resizePolicy = caf::PdmUiTableViewEditorAttribute::RESIZE_TO_FILL_CONTAINER;
tvAttribute->alwaysEnforceResizePolicy = true;
tvAttribute->minimumHeight = 300;
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPressureTable::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_pressureTableItems );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPressureTable::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ )
{
uiTreeOrdering.skipRemainingChildren( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPressureTable::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
onTableChanged();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimPressureTable::usePressureTableForProperty( RiaDefines::CurveProperty curveProperty ) const
{
if ( curveProperty == RiaDefines::CurveProperty::INITIAL_PRESSURE )
return m_useForInitialPressure();
else if ( curveProperty == RiaDefines::CurveProperty::PRESSURE )
return m_useForPressure();
else
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPressureTable::onTableChanged( const caf::SignalEmitter* emitter )
{
changed.send();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPressureTable::initAfterRead()
{
for ( auto item : items() )
{
item->changed.connect( this, &RimPressureTable::onTableChanged );
}
}

View File

@ -0,0 +1,62 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafPdmChildArrayField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "RiaStimPlanModelDefines.h"
class RimPressureTableItem;
class RimPressureTable : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimPressureTable();
~RimPressureTable() override;
caf::Signal<> changed;
std::vector<RimPressureTableItem*> items() const;
void insertItem( RimPressureTableItem* insertBefore, RimPressureTableItem* item );
void deleteItem( RimPressureTableItem* itemToDelete );
void deleteAllItems();
bool usePressureTableForProperty( RiaDefines::CurveProperty curveProperty ) const;
protected:
void defineCustomContextMenu( const caf::PdmFieldHandle* fieldNeedingMenu, QMenu* menu, QWidget* fieldEditorWidget ) override;
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void onTableChanged( const caf::SignalEmitter* emitter = nullptr );
void initAfterRead();
private:
caf::PdmField<bool> m_useForInitialPressure;
caf::PdmField<bool> m_useForPressure;
caf::PdmChildArrayField<RimPressureTableItem*> m_pressureTableItems;
};

View File

@ -0,0 +1,86 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimPressureTableItem.h"
#include "cafPdmUiCheckBoxEditor.h"
#include "cafPdmUiLineEditor.h"
CAF_PDM_SOURCE_INIT( RimPressureTableItem, "PressureTableItem" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPressureTableItem::RimPressureTableItem()
: changed( this )
{
CAF_PDM_InitField( &m_depth, "Depth", 0.0, "Depth", "", "", "" );
CAF_PDM_InitField( &m_initialPressure, "InitialPressure", 0.0, "Initial Pressure", "", "", "" );
CAF_PDM_InitField( &m_pressure, "Pressure", 0.0, "Pressure", "", "", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPressureTableItem::~RimPressureTableItem()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPressureTableItem::setValues( double depth, double initialPressure, double pressure )
{
m_depth = depth;
m_initialPressure = initialPressure;
m_pressure = pressure;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimPressureTableItem::depth() const
{
return m_depth;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimPressureTableItem::initialPressure() const
{
return m_initialPressure;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimPressureTableItem::pressure() const
{
return m_pressure;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPressureTableItem::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
changed.send();
}

View File

@ -0,0 +1,51 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafPdmField.h"
#include "cafPdmObject.h"
//==================================================================================================
///
///
//==================================================================================================
class RimPressureTableItem : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimPressureTableItem();
~RimPressureTableItem() override;
caf::Signal<> changed;
void setValues( double depth, double initialPressure, double pressure );
double depth() const;
double initialPressure() const;
double pressure() const;
private:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
private:
caf::PdmField<int> m_faciesValue;
caf::PdmField<double> m_depth;
caf::PdmField<double> m_initialPressure;
caf::PdmField<double> m_pressure;
};

View File

@ -19,8 +19,15 @@
#include "RiaDefines.h"
#include "RiaInterpolationTools.h"
#include "RiaLogging.h"
#include "RiaStimPlanModelDefines.h"
#include "RigWellPath.h"
#include "RigWellPathGeometryTools.h"
#include "RimModeledWellPath.h"
#include "RimPressureTable.h"
#include "RimPressureTableItem.h"
#include "RimStimPlanModel.h"
#include "RimStimPlanModelCalculator.h"
#include "RimStimPlanModelTemplate.h"
@ -117,14 +124,25 @@ bool RimStimPlanModelPressureCalculator::extractValuesForProperty( RiaDefines::C
}
}
// Extract the property we care about
RimStimPlanModelWellLogCalculator::extractValuesForProperty( curveProperty,
stimPlanModel,
timeStep,
values,
measuredDepthValues,
tvDepthValues,
rkbDiff );
if ( stimPlanModel->stimPlanModelTemplate()->usePressureTableForProperty( curveProperty ) )
{
if ( !extractPressureDataFromTable( curveProperty, stimPlanModel, values, measuredDepthValues, tvDepthValues ) )
{
RiaLogging::error( "Unable to extract pressure data from table" );
return false;
}
}
else
{
// Extract the property we care about
RimStimPlanModelWellLogCalculator::extractValuesForProperty( curveProperty,
stimPlanModel,
timeStep,
values,
measuredDepthValues,
tvDepthValues,
rkbDiff );
}
if ( staticTvDepthValues.size() != tvDepthValues.size() )
{
@ -232,3 +250,57 @@ bool RimStimPlanModelPressureCalculator::extractValuesForProperty( RiaDefines::C
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimStimPlanModelPressureCalculator::extractPressureDataFromTable( RiaDefines::CurveProperty curveProperty,
const RimStimPlanModel* stimPlanModel,
std::vector<double>& values,
std::vector<double>& measuredDepthValues,
std::vector<double>& tvDepthValues ) const
{
RimStimPlanModelTemplate* stimPlanModelTemplate = stimPlanModel->stimPlanModelTemplate();
if ( !stimPlanModelTemplate ) return false;
RimPressureTable* pressureTable = stimPlanModelTemplate->pressureTable();
if ( !pressureTable ) return false;
std::vector<RimPressureTableItem*> items = pressureTable->items();
if ( items.empty() ) return false;
if ( !stimPlanModel->thicknessDirectionWellPath() )
{
return false;
}
RigWellPath* wellPathGeometry = stimPlanModel->thicknessDirectionWellPath()->wellPathGeometry();
if ( !wellPathGeometry )
{
RiaLogging::error( "No well path geometry found for pressure data table." );
return false;
}
// Convert table data into a "fake" well log extraction
for ( RimPressureTableItem* item : items )
{
if ( curveProperty == RiaDefines::CurveProperty::INITIAL_PRESSURE )
values.push_back( item->initialPressure() );
else
{
values.push_back( item->pressure() );
}
tvDepthValues.push_back( item->depth() );
}
// Interpolate MDs from the tvd data from the table and well path geometry
const std::vector<double>& mdValuesOfWellPath = wellPathGeometry->measuredDepths();
const std::vector<double>& tvdValuesOfWellPath = wellPathGeometry->trueVerticalDepths();
measuredDepthValues =
RigWellPathGeometryTools::interpolateMdFromTvd( mdValuesOfWellPath, tvdValuesOfWellPath, tvDepthValues );
CVF_ASSERT( measuredDepthValues.size() == tvDepthValues.size() );
return true;
}

View File

@ -51,4 +51,10 @@ protected:
std::vector<double>& measuredDepthValues,
std::vector<double>& tvDepthValues,
double& rkbDiff ) const override;
bool extractPressureDataFromTable( RiaDefines::CurveProperty curveProperty,
const RimStimPlanModel* stimPlanModel,
std::vector<double>& values,
std::vector<double>& measuredDepthValues,
std::vector<double>& tvDepthValues ) const;
};

View File

@ -33,6 +33,7 @@
#include "RimFaciesInitialPressureConfig.h"
#include "RimFaciesProperties.h"
#include "RimNonNetLayers.h"
#include "RimPressureTable.h"
#include "RimProject.h"
#include "RimStimPlanModel.h"
#include "RimStimPlanModelPlot.h"
@ -167,6 +168,11 @@ RimStimPlanModelTemplate::RimStimPlanModelTemplate()
m_faciesInitialPressureConfigs.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
m_faciesInitialPressureConfigs.uiCapability()->setUiTreeChildrenHidden( true );
CAF_PDM_InitScriptableFieldNoDefault( &m_pressureTable, "PressureTable", "Pressure Table", "", "", "" );
m_pressureTable.uiCapability()->setUiHidden( true );
m_pressureTable.uiCapability()->setUiTreeHidden( true );
setPressureTable( new RimPressureTable );
CAF_PDM_InitScriptableFieldNoDefault( &m_elasticProperties, "ElasticProperties", "Elastic Properties", "", "", "" );
m_elasticProperties.uiCapability()->setUiHidden( true );
m_elasticProperties.uiCapability()->setUiTreeHidden( true );
@ -297,6 +303,7 @@ void RimStimPlanModelTemplate::defineUiOrdering( QString uiConfigName, caf::PdmU
caf::PdmUiOrdering* faciesInitialPressureGroup = uiOrdering.addNewGroup( "Facies With Initial Pressure" );
faciesInitialPressureGroup->add( &m_faciesInitialPressureConfigs );
uiOrdering.skipRemainingFields( true );
}
@ -442,6 +449,32 @@ RimNonNetLayers* RimStimPlanModelTemplate::nonNetLayers() const
return m_nonNetLayers;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimStimPlanModelTemplate::setPressureTable( RimPressureTable* pressureTable )
{
if ( m_pressureTable )
{
m_pressureTable->changed.disconnect( this );
}
m_pressureTable = pressureTable;
if ( m_pressureTable )
{
m_pressureTable->changed.connect( this, &RimStimPlanModelTemplate::pressureTableChanged );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimPressureTable* RimStimPlanModelTemplate::pressureTable() const
{
return m_pressureTable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -490,6 +523,14 @@ void RimStimPlanModelTemplate::nonNetLayersChanged( const caf::SignalEmitter* em
changed.send();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimStimPlanModelTemplate::pressureTableChanged( const caf::SignalEmitter* emitter )
{
changed.send();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -764,3 +805,13 @@ std::map<int, double> RimStimPlanModelTemplate::faciesWithInitialPressure() cons
return valueFractionMap;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimStimPlanModelTemplate::usePressureTableForProperty( RiaDefines::CurveProperty curveProperty ) const
{
if ( !m_pressureTable ) return false;
return m_pressureTable->usePressureTableForProperty( curveProperty );
}

View File

@ -38,6 +38,7 @@ class RigEclipseCaseData;
class RimFaciesProperties;
class RimNonNetLayers;
class RimFaciesInitialPressureConfig;
class RimPressureTable;
//==================================================================================================
///
@ -108,8 +109,13 @@ public:
void setNonNetLayers( RimNonNetLayers* nonNetLayers );
RimNonNetLayers* nonNetLayers() const;
void setPressureTable( RimPressureTable* pressureTable );
RimPressureTable* pressureTable() const;
void updateReferringPlots();
bool usePressureTableForProperty( RiaDefines::CurveProperty curveProperty ) const;
protected:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
@ -126,6 +132,7 @@ private:
void faciesPropertiesChanged( const caf::SignalEmitter* emitter );
void elasticPropertiesChanged( const caf::SignalEmitter* emitter );
void nonNetLayersChanged( const caf::SignalEmitter* emitter );
void pressureTableChanged( const caf::SignalEmitter* emitter );
double computeDefaultStressDepth() const;
@ -158,4 +165,5 @@ private:
caf::PdmChildField<RimNonNetLayers*> m_nonNetLayers;
caf::PdmChildArrayField<RimFaciesInitialPressureConfig*> m_faciesInitialPressureConfigs;
caf::PdmChildField<RimPressureTable*> m_pressureTable;
};