2019-09-05 05:24:45 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2019- 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.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
2023-03-31 09:27:14 -05:00
|
|
|
|
2019-09-05 05:24:45 -05:00
|
|
|
#include "RimWellBoreStabilityPlot.h"
|
|
|
|
|
2020-01-17 03:29:58 -06:00
|
|
|
#include "RiaDefines.h"
|
2020-02-24 08:42:23 -06:00
|
|
|
#include "RicfCommandObject.h"
|
|
|
|
|
2019-09-05 05:24:45 -05:00
|
|
|
#include "RigFemPartResultsCollection.h"
|
|
|
|
#include "RigFemResultAddress.h"
|
|
|
|
#include "RigGeoMechCaseData.h"
|
|
|
|
|
|
|
|
#include "RimGeoMechCase.h"
|
|
|
|
#include "RimTools.h"
|
2020-01-17 03:29:58 -06:00
|
|
|
#include "RimWbsParameters.h"
|
2019-09-05 05:24:45 -05:00
|
|
|
#include "RimWellLogCurveCommonDataSource.h"
|
|
|
|
#include "RimWellLogFile.h"
|
2022-10-12 05:41:08 -05:00
|
|
|
#include "RimWellLogPlotNameConfig.h"
|
2019-09-05 05:24:45 -05:00
|
|
|
|
|
|
|
#include "cafPdmBase.h"
|
2020-08-21 04:13:07 -05:00
|
|
|
#include "cafPdmFieldScriptingCapability.h"
|
2019-09-05 05:24:45 -05:00
|
|
|
#include "cafPdmObject.h"
|
2020-08-21 04:13:07 -05:00
|
|
|
#include "cafPdmObjectScriptingCapability.h"
|
2019-11-06 03:07:56 -06:00
|
|
|
#include "cafPdmUiComboBoxEditor.h"
|
2019-09-05 05:24:45 -05:00
|
|
|
#include "cafPdmUiGroup.h"
|
|
|
|
|
2020-02-24 08:42:23 -06:00
|
|
|
CAF_PDM_SOURCE_INIT( RimWellBoreStabilityPlot, "WellBoreStabilityPlot" );
|
2019-09-05 05:24:45 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimWellBoreStabilityPlot::RimWellBoreStabilityPlot()
|
|
|
|
{
|
2023-02-26 03:48:40 -06:00
|
|
|
CAF_PDM_InitScriptableObject( "Well Bore Stability Plot", ":/WellBoreStability16x16.png", "", "A GeoMechanical Well Bore Stability Plot" );
|
|
|
|
|
|
|
|
CAF_PDM_InitScriptableFieldWithScriptKeywordNoDefault( &m_wbsParameters, "WbsParameters", "Parameters", "Well Bore Stability Parameters" );
|
2020-01-17 03:29:58 -06:00
|
|
|
m_wbsParameters = new RimWbsParameters;
|
2020-01-28 02:26:07 -06:00
|
|
|
m_wbsParameters.uiCapability()->setUiTreeHidden( true );
|
|
|
|
m_wbsParameters.uiCapability()->setUiTreeChildrenHidden( true );
|
2019-11-26 01:45:17 -06:00
|
|
|
|
|
|
|
m_nameConfig->setCustomName( "Well Bore Stability" );
|
|
|
|
m_nameConfig->enableAllAutoNameTags( true );
|
2019-09-05 05:24:45 -05:00
|
|
|
|
2020-04-24 00:13:33 -05:00
|
|
|
m_commonDataSource->setCaseType( RiaDefines::CaseType::GEOMECH_ODB_CASE );
|
2021-01-15 03:32:36 -06:00
|
|
|
|
|
|
|
m_waterDepth = std::numeric_limits<double>::infinity();
|
2019-09-05 05:24:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-01-17 03:29:58 -06:00
|
|
|
void RimWellBoreStabilityPlot::applyWbsParametersToExtractor( RigGeoMechWellLogExtractor* extractor )
|
2019-09-05 05:24:45 -05:00
|
|
|
{
|
2021-01-21 04:51:16 -06:00
|
|
|
auto originalValue = m_waterDepth;
|
|
|
|
m_waterDepth = extractor->waterDepth();
|
2021-01-15 03:32:36 -06:00
|
|
|
|
2021-01-21 04:51:16 -06:00
|
|
|
if ( m_waterDepth == std::numeric_limits<double>::infinity() )
|
|
|
|
{
|
|
|
|
m_waterDepth = extractor->estimateWaterDepth();
|
|
|
|
}
|
2021-01-15 03:32:36 -06:00
|
|
|
|
2020-01-17 03:29:58 -06:00
|
|
|
m_wbsParameters->applyWbsParametersToExtractor( extractor );
|
2021-01-21 04:51:16 -06:00
|
|
|
|
|
|
|
if ( originalValue != m_waterDepth )
|
|
|
|
{
|
|
|
|
performAutoNameUpdate();
|
|
|
|
}
|
2019-09-05 05:24:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-11-06 03:07:56 -06:00
|
|
|
double RimWellBoreStabilityPlot::userDefinedValue( const RigWbsParameter& parameter ) const
|
2019-09-05 05:24:45 -05:00
|
|
|
{
|
2020-01-17 03:29:58 -06:00
|
|
|
return m_wbsParameters->userDefinedValue( parameter );
|
2019-09-05 05:24:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-01-17 03:35:42 -06:00
|
|
|
void RimWellBoreStabilityPlot::copyWbsParameters( const RimWbsParameters* wbsParameters )
|
2019-09-05 05:24:45 -05:00
|
|
|
{
|
2020-01-17 03:35:42 -06:00
|
|
|
if ( wbsParameters )
|
|
|
|
{
|
|
|
|
*m_wbsParameters = *wbsParameters;
|
|
|
|
}
|
2019-09-05 05:24:45 -05:00
|
|
|
}
|
|
|
|
|
2020-03-02 06:26:05 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2023-02-26 03:48:40 -06:00
|
|
|
void RimWellBoreStabilityPlot::setCaseWellPathAndTimeStep( RimGeoMechCase* geoMechCase, RimWellPath* wellPath, int timeStep, int frameIndex /* = -1 */ )
|
2020-03-02 06:26:05 -06:00
|
|
|
{
|
|
|
|
m_wbsParameters->setGeoMechCase( geoMechCase );
|
|
|
|
m_wbsParameters->setWellPath( wellPath );
|
|
|
|
m_wbsParameters->setTimeStep( timeStep );
|
2023-01-18 07:42:33 -06:00
|
|
|
m_wbsParameters->setFrameIndex( frameIndex );
|
2020-03-02 06:26:05 -06:00
|
|
|
}
|
|
|
|
|
2019-09-05 05:24:45 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-13 09:51:21 -05:00
|
|
|
void RimWellBoreStabilityPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
2019-09-05 05:24:45 -05:00
|
|
|
{
|
2019-10-11 08:54:19 -05:00
|
|
|
m_commonDataSource->uiOrdering( RimWellLogCurveCommonDataSource::smoothingUiOrderinglabel(), uiOrdering );
|
2019-09-25 04:59:31 -05:00
|
|
|
|
2020-01-17 03:29:58 -06:00
|
|
|
caf::PdmUiGroup* parametersGroup = uiOrdering.addNewGroup( "Parameter Sources" );
|
|
|
|
m_wbsParameters->uiOrdering( uiConfigName, *parametersGroup );
|
2019-09-25 04:59:31 -05:00
|
|
|
|
2020-01-08 03:31:01 -06:00
|
|
|
caf::PdmUiGroup* depthGroup = uiOrdering.addNewGroup( "Depth Axis" );
|
|
|
|
RimWellLogPlot::uiOrderingForDepthAxis( uiConfigName, *depthGroup );
|
|
|
|
|
|
|
|
caf::PdmUiGroup* titleGroup = uiOrdering.addNewGroup( "Plot Title" );
|
|
|
|
RimWellLogPlot::uiOrderingForAutoName( uiConfigName, *titleGroup );
|
|
|
|
|
2022-10-19 08:13:15 -05:00
|
|
|
caf::PdmUiGroup* legendGroup = uiOrdering.addNewGroup( "Legends" );
|
|
|
|
legendGroup->setCollapsedByDefault();
|
|
|
|
RimPlotWindow::uiOrderingForLegends( uiConfigName, *legendGroup, true );
|
|
|
|
|
2023-07-07 00:53:22 -05:00
|
|
|
RimDepthTrackPlot::uiOrderingForFonts( uiConfigName, uiOrdering );
|
2019-09-25 04:59:31 -05:00
|
|
|
|
|
|
|
uiOrdering.skipRemainingFields( true );
|
2019-09-05 05:24:45 -05:00
|
|
|
}
|
|
|
|
|
2019-11-06 03:07:56 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellBoreStabilityPlot::onLoadDataAndUpdate()
|
|
|
|
{
|
2020-01-17 03:29:58 -06:00
|
|
|
m_wbsParameters->loadDataAndUpdate();
|
2019-09-30 08:34:47 -05:00
|
|
|
RimWellLogPlot::onLoadDataAndUpdate();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-01-17 03:29:58 -06:00
|
|
|
void RimWellBoreStabilityPlot::childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField )
|
2019-09-30 08:34:47 -05:00
|
|
|
{
|
2020-01-17 03:29:58 -06:00
|
|
|
if ( changedChildField == &m_commonDataSource )
|
2019-09-30 08:34:47 -05:00
|
|
|
{
|
2020-01-17 03:29:58 -06:00
|
|
|
applyDataSource();
|
2019-09-30 08:34:47 -05:00
|
|
|
}
|
2020-01-17 03:29:58 -06:00
|
|
|
else if ( changedChildField == &m_wbsParameters )
|
2019-09-05 05:24:45 -05:00
|
|
|
{
|
2023-08-04 02:04:14 -05:00
|
|
|
loadDataAndUpdate();
|
2019-09-05 05:24:45 -05:00
|
|
|
}
|
2019-09-30 08:34:47 -05:00
|
|
|
}
|
2019-09-05 05:24:45 -05:00
|
|
|
|
2019-09-30 08:34:47 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-01-17 03:29:58 -06:00
|
|
|
void RimWellBoreStabilityPlot::initAfterRead()
|
2019-09-30 08:34:47 -05:00
|
|
|
{
|
2020-01-29 05:52:07 -06:00
|
|
|
updateCommonDataSource();
|
2020-01-17 03:29:58 -06:00
|
|
|
applyDataSource();
|
2019-09-05 05:24:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-10-12 05:41:08 -05:00
|
|
|
QStringList RimWellBoreStabilityPlot::supportedPlotNameVariables() const
|
2019-09-05 05:24:45 -05:00
|
|
|
{
|
2022-10-12 05:41:08 -05:00
|
|
|
auto variables = RimWellLogPlot::supportedPlotNameVariables();
|
|
|
|
|
|
|
|
variables.append( RiaDefines::namingVariableWaterDepth() );
|
|
|
|
|
|
|
|
return variables;
|
2019-09-05 05:24:45 -05:00
|
|
|
}
|
2021-01-15 03:32:36 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-10-12 05:41:08 -05:00
|
|
|
std::map<QString, QString> RimWellBoreStabilityPlot::createNameKeyValueMap() const
|
2021-01-15 03:32:36 -06:00
|
|
|
{
|
2022-10-12 05:41:08 -05:00
|
|
|
auto nameKeyValueMap = RimWellLogPlot::createNameKeyValueMap();
|
2021-01-15 03:32:36 -06:00
|
|
|
|
2022-10-12 05:41:08 -05:00
|
|
|
QString waterDepthString = QString( "Water Depth = %1 m" ).arg( m_waterDepth );
|
|
|
|
nameKeyValueMap[RiaDefines::namingVariableWaterDepth()] = waterDepthString;
|
|
|
|
|
|
|
|
return nameKeyValueMap;
|
|
|
|
}
|
2021-01-15 03:32:36 -06:00
|
|
|
|
2022-10-12 05:41:08 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellBoreStabilityPlot::applyDataSource()
|
|
|
|
{
|
|
|
|
m_wbsParameters->setGeoMechCase( dynamic_cast<RimGeoMechCase*>( m_commonDataSource->caseToApply() ) );
|
|
|
|
m_wbsParameters->setWellPath( m_commonDataSource->wellPathToApply() );
|
|
|
|
m_wbsParameters->setTimeStep( m_commonDataSource->timeStepToApply() );
|
2023-01-18 07:42:33 -06:00
|
|
|
m_wbsParameters->setFrameIndex( -1 );
|
2022-11-30 16:13:39 -06:00
|
|
|
|
2023-08-04 02:04:14 -05:00
|
|
|
updateConnectedEditors();
|
2021-01-15 03:32:36 -06:00
|
|
|
}
|