#4665 Implement a Well Bore Stability Plot class

* Trigger updates when Ui fields are changed
  * Show only WBS parameter options that have available data
  * Clang-format WBS stuff
This commit is contained in:
Gaute Lindkvist 2019-09-05 12:24:45 +02:00
parent e550b435e4
commit 129df990ae
12 changed files with 1529 additions and 937 deletions

View File

@ -1,42 +1,42 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewWellBoreStabilityPlotFeature.h"
#include "RicNewWellLogPlotFeatureImpl.h"
#include "RicNewWellLogFileCurveFeature.h"
#include "RicNewWellLogCurveExtractionFeature.h"
#include "RicNewWellLogFileCurveFeature.h"
#include "RicNewWellLogPlotFeatureImpl.h"
#include "RicWellLogTools.h"
#include "RigFemResultAddress.h"
#include "RigFemPartResultsCollection.h"
#include "RigFemResultAddress.h"
#include "RigGeoMechCaseData.h"
#include "RigWellPath.h"
#include "RimGeoMechCase.h"
#include "RimGeoMechView.h"
#include "RimProject.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotCollection.h"
#include "RimWellLogTrack.h"
#include "RimWellBoreStabilityPlot.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellLogFile.h"
#include "RimWellLogFileCurve.h"
#include "RimWellLogFileChannel.h"
#include "RimWellLogFileCurve.h"
#include "RimWellLogPlotCollection.h"
#include "RimWellLogTrack.h"
#include "RimWellPath.h"
#include "RicWellLogTools.h"
@ -44,10 +44,10 @@
#include "RiaApplication.h"
#include "cvfAssert.h"
#include "cvfMath.h"
#include "cafProgressInfo.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include "cvfMath.h"
#include <QAction>
#include <QDateTime>
@ -55,168 +55,187 @@
#include <algorithm>
CAF_CMD_SOURCE_INIT(RicNewWellBoreStabilityPlotFeature, "RicNewWellBoreStabilityPlotFeature");
CAF_CMD_SOURCE_INIT( RicNewWellBoreStabilityPlotFeature, "RicNewWellBoreStabilityPlotFeature" );
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
bool RicNewWellBoreStabilityPlotFeature::isCommandEnabled()
{
{
Rim3dView* view = RiaApplication::instance()->activeReservoirView();
if (!view) return false;
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>(view);
return geoMechView != nullptr;
if ( !view ) return false;
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>( view );
return geoMechView != nullptr;
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewWellBoreStabilityPlotFeature::onActionTriggered(bool isChecked)
void RicNewWellBoreStabilityPlotFeature::onActionTriggered( bool isChecked )
{
RimWellPath* wellPath = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellPath>();
RimWellLogPlotCollection* plotCollection = caf::SelectionManager::instance()->selectedItemOfType<RimWellLogPlotCollection>();
if (!wellPath)
RimWellPath* wellPath = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellPath>();
RimWellLogPlotCollection* plotCollection = caf::SelectionManager::instance()
->selectedItemOfType<RimWellLogPlotCollection>();
if ( !wellPath )
{
if (plotCollection)
if ( plotCollection )
{
RimProject* project = nullptr;
plotCollection->firstAncestorOrThisOfTypeAsserted(project);
plotCollection->firstAncestorOrThisOfTypeAsserted( project );
std::vector<RimWellPath*> allWellPaths;
project->descendantsIncludingThisOfType(allWellPaths);
if (!allWellPaths.empty())
project->descendantsIncludingThisOfType( allWellPaths );
if ( !allWellPaths.empty() )
{
wellPath = allWellPaths.front();
}
}
}
if (!wellPath)
if ( !wellPath )
{
return;
}
Rim3dView* view = RiaApplication::instance()->activeReservoirView();
if (!view) return;
if ( !view ) return;
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>(view);
if (!geoMechView) return;
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>( view );
if ( !geoMechView ) return;
caf::ProgressInfo progInfo(100, "Creating Well Bore Stability Plot");
caf::ProgressInfo progInfo( 100, "Creating Well Bore Stability Plot" );
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
RimWellLogPlot* plot = RicNewWellLogPlotFeatureImpl::createWellLogPlot(false, "Well Bore Stability");
RimGeoMechCase* geoMechCase = geoMechView->geoMechCase();
RimWellBoreStabilityPlot* plot = RicNewWellLogPlotFeatureImpl::createWellBoreStabilityPlot( false,
"Well Bore Stability" );
{
auto task = progInfo.task("Creating formation track", 2);
createFormationTrack(plot, wellPath, geoMechCase);
}
{
auto task = progInfo.task("Creating well design track", 3);
createCasingShoeTrack(plot, wellPath, geoMechCase);
auto task = progInfo.task( "Creating formation track", 2 );
createFormationTrack( plot, wellPath, geoMechCase );
}
{
auto task = progInfo.task("Creating stability curves track", 75);
createStabilityCurvesTrack(plot, wellPath, geoMechView);
auto task = progInfo.task( "Creating well design track", 3 );
createCasingShoeTrack( plot, wellPath, geoMechCase );
}
{
auto task = progInfo.task("Creating angles track", 15);
createAnglesTrack(plot, wellPath, geoMechView);
auto task = progInfo.task( "Creating stability curves track", 75 );
createStabilityCurvesTrack( plot, wellPath, geoMechView );
}
{
auto task = progInfo.task("Updating all tracks", 5);
plot->enableAllAutoNameTags(true);
plot->setPlotTitleVisible(true);
plot->setTrackLegendsVisible(true);
plot->setTrackLegendsHorizontal(true);
plot->setDepthType(RimWellLogPlot::TRUE_VERTICAL_DEPTH);
plot->setDepthAutoZoom(true);
RicNewWellLogPlotFeatureImpl::updateAfterCreation(plot);
auto task = progInfo.task( "Creating angles track", 15 );
createAnglesTrack( plot, wellPath, geoMechView );
}
RiuPlotMainWindowTools::selectAsCurrentItem(plot);
{
auto task = progInfo.task( "Updating all tracks", 5 );
plot->enableAllAutoNameTags( true );
plot->setPlotTitleVisible( true );
plot->setTrackLegendsVisible( true );
plot->setTrackLegendsHorizontal( true );
plot->setDepthType( RimWellLogPlot::TRUE_VERTICAL_DEPTH );
plot->setDepthAutoZoom( true );
RicNewWellLogPlotFeatureImpl::updateAfterCreation( plot );
}
RiuPlotMainWindowTools::selectAsCurrentItem( plot );
// Make sure the summary plot window is visible
RiuPlotMainWindowTools::showPlotMainWindow();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RicNewWellBoreStabilityPlotFeature::setupActionLook(QAction* actionToSetup)
void RicNewWellBoreStabilityPlotFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText("New Well Bore Stability Plot");
actionToSetup->setIcon(QIcon(":/WellLogPlot16x16.png"));
actionToSetup->setText( "New Well Bore Stability Plot" );
actionToSetup->setIcon( QIcon( ":/WellLogPlot16x16.png" ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellBoreStabilityPlotFeature::createFormationTrack(RimWellLogPlot* plot, RimWellPath* wellPath, RimGeoMechCase* geoMechCase)
void RicNewWellBoreStabilityPlotFeature::createFormationTrack( RimWellBoreStabilityPlot* plot,
RimWellPath* wellPath,
RimGeoMechCase* geoMechCase )
{
RimWellLogTrack* formationTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack(false, "Formations", plot);
formationTrack->setFormationWellPath(wellPath);
formationTrack->setFormationCase(geoMechCase);
formationTrack->setShowFormations(true);
formationTrack->setVisibleXRange(0.0, 0.0);
formationTrack->setWidthScaleFactor(RimWellLogTrack::NARROW_TRACK);
RimWellLogTrack* formationTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, "Formations", plot );
formationTrack->setFormationWellPath( wellPath );
formationTrack->setFormationCase( geoMechCase );
formationTrack->setShowFormations( true );
formationTrack->setVisibleXRange( 0.0, 0.0 );
formationTrack->setWidthScaleFactor( RimWellLogTrack::NARROW_TRACK );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellBoreStabilityPlotFeature::createCasingShoeTrack(RimWellLogPlot* plot, RimWellPath* wellPath, RimGeoMechCase* geoMechCase)
void RicNewWellBoreStabilityPlotFeature::createCasingShoeTrack( RimWellBoreStabilityPlot* plot,
RimWellPath* wellPath,
RimGeoMechCase* geoMechCase )
{
RimWellLogTrack* casingShoeTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack(false, "Well Design", plot);
casingShoeTrack->setWidthScaleFactor(RimWellLogTrack::NARROW_TRACK);
casingShoeTrack->setFormationWellPath(wellPath);
casingShoeTrack->setFormationCase(geoMechCase);
casingShoeTrack->setShowFormations(true);
casingShoeTrack->setShowFormationLabels(false);
casingShoeTrack->setShowWellPathAttributes(true);
casingShoeTrack->setWellPathAttributesSource(wellPath);
casingShoeTrack->setVisibleXRange(0.0, 0.0);
casingShoeTrack->setAutoScaleXEnabled(true);
casingShoeTrack->loadDataAndUpdate();
RimWellLogTrack* casingShoeTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, "Well Design", plot );
casingShoeTrack->setWidthScaleFactor( RimWellLogTrack::NARROW_TRACK );
casingShoeTrack->setFormationWellPath( wellPath );
casingShoeTrack->setFormationCase( geoMechCase );
casingShoeTrack->setShowFormations( true );
casingShoeTrack->setShowFormationLabels( false );
casingShoeTrack->setShowWellPathAttributes( true );
casingShoeTrack->setWellPathAttributesSource( wellPath );
casingShoeTrack->setVisibleXRange( 0.0, 0.0 );
casingShoeTrack->setAutoScaleXEnabled( true );
casingShoeTrack->loadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack(RimWellLogPlot* plot, RimWellPath* wellPath, RimGeoMechView* geoMechView)
void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBoreStabilityPlot* plot,
RimWellPath* wellPath,
RimGeoMechView* geoMechView )
{
RimWellLogTrack* stabilityCurvesTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack(false, "Stability Curves", plot);
stabilityCurvesTrack->setWidthScaleFactor(RimWellLogTrack::EXTRA_WIDE_TRACK);
stabilityCurvesTrack->setAutoScaleXEnabled(true);
stabilityCurvesTrack->setTickIntervals(0.5, 0.05);
stabilityCurvesTrack->setXAxisGridVisibility(RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR);
stabilityCurvesTrack->setFormationWellPath(wellPath);
stabilityCurvesTrack->setFormationCase(geoMechView->geoMechCase());
stabilityCurvesTrack->setShowFormations(true);
stabilityCurvesTrack->setShowFormationLabels(false);
RimWellLogTrack* stabilityCurvesTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false,
"Stability Curves",
plot );
stabilityCurvesTrack->setWidthScaleFactor( RimWellLogTrack::EXTRA_WIDE_TRACK );
stabilityCurvesTrack->setAutoScaleXEnabled( true );
stabilityCurvesTrack->setTickIntervals( 0.5, 0.05 );
stabilityCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
stabilityCurvesTrack->setFormationWellPath( wellPath );
stabilityCurvesTrack->setFormationCase( geoMechView->geoMechCase() );
stabilityCurvesTrack->setShowFormations( true );
stabilityCurvesTrack->setShowFormationLabels( false );
std::vector<QString> resultNames = RiaDefines::wellPathStabilityResultNames();
std::vector<cvf::Color3f> colors = { cvf::Color3f::RED, cvf::Color3f::PURPLE, cvf::Color3f::GREEN, cvf::Color3f::BLUE, cvf::Color3f::ORANGE };
std::vector<RiuQwtPlotCurve::LineStyleEnum> lineStyles = { RiuQwtPlotCurve::STYLE_SOLID, RiuQwtPlotCurve::STYLE_DASH, RiuQwtPlotCurve::STYLE_DASH_DOT, RiuQwtPlotCurve::STYLE_SOLID, RiuQwtPlotCurve::STYLE_DASH};
for (size_t i = 0; i < resultNames.size(); ++i)
std::vector<cvf::Color3f> colors = {cvf::Color3f::RED,
cvf::Color3f::PURPLE,
cvf::Color3f::GREEN,
cvf::Color3f::BLUE,
cvf::Color3f::ORANGE};
std::vector<RiuQwtPlotCurve::LineStyleEnum> lineStyles = {RiuQwtPlotCurve::STYLE_SOLID,
RiuQwtPlotCurve::STYLE_DASH,
RiuQwtPlotCurve::STYLE_DASH_DOT,
RiuQwtPlotCurve::STYLE_SOLID,
RiuQwtPlotCurve::STYLE_DASH};
for ( size_t i = 0; i < resultNames.size(); ++i )
{
const QString& resultName = resultNames[i];
RigFemResultAddress resAddr(RIG_WELLPATH_DERIVED, resultName.toStdString(), "");
RimWellLogExtractionCurve* curve = RicWellLogTools::addExtractionCurve(stabilityCurvesTrack, geoMechView, wellPath, nullptr, 0, false, false);
curve->setGeoMechResultAddress(resAddr);
curve->setCurrentTimeStep(geoMechView->currentTimeStep());
curve->setCustomName(resultName);
curve->setColor(colors[i % colors.size()]);
curve->setLineStyle(lineStyles[i % lineStyles.size()]);
curve->setLineThickness(2);
curve->loadDataAndUpdate(false);
const QString& resultName = resultNames[i];
RigFemResultAddress resAddr( RIG_WELLPATH_DERIVED, resultName.toStdString(), "" );
RimWellLogExtractionCurve* curve =
RicWellLogTools::addExtractionCurve( stabilityCurvesTrack, geoMechView, wellPath, nullptr, 0, false, false );
curve->setGeoMechResultAddress( resAddr );
curve->setCurrentTimeStep( geoMechView->currentTimeStep() );
curve->setCustomName( resultName );
curve->setColor( colors[i % colors.size()] );
curve->setLineStyle( lineStyles[i % lineStyles.size()] );
curve->setLineThickness( 2 );
curve->loadDataAndUpdate( false );
}
stabilityCurvesTrack->calculateXZoomRangeAndUpdateQwt();
}
@ -224,51 +243,56 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack(RimWellLogPl
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellBoreStabilityPlotFeature::createAnglesTrack(RimWellLogPlot* plot, RimWellPath* wellPath, RimGeoMechView* geoMechView)
void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStabilityPlot* plot,
RimWellPath* wellPath,
RimGeoMechView* geoMechView )
{
RimWellLogTrack* wellPathAnglesTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack(false, "Well Path Angles", plot);
double minValue = 360.0, maxValue = 0.0;
const double angleIncrement = 90.0;
std::vector<QString> resultNames = RiaDefines::wellPathAngleResultNames();
std::vector<cvf::Color3f> colors = { cvf::Color3f::DARK_RED, cvf::Color3f::BLUE };
RimWellLogTrack* wellPathAnglesTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false,
"Well Path Angles",
plot );
double minValue = 360.0, maxValue = 0.0;
const double angleIncrement = 90.0;
std::vector<QString> resultNames = RiaDefines::wellPathAngleResultNames();
std::vector<RiuQwtPlotCurve::LineStyleEnum> lineStyles = { RiuQwtPlotCurve::STYLE_SOLID, RiuQwtPlotCurve::STYLE_DASH };
std::vector<cvf::Color3f> colors = {cvf::Color3f::DARK_RED, cvf::Color3f::BLUE};
for (size_t i = 0; i < resultNames.size(); ++i)
std::vector<RiuQwtPlotCurve::LineStyleEnum> lineStyles = {RiuQwtPlotCurve::STYLE_SOLID, RiuQwtPlotCurve::STYLE_DASH};
for ( size_t i = 0; i < resultNames.size(); ++i )
{
const QString& resultName = resultNames[i];
RigFemResultAddress resAddr(RIG_WELLPATH_DERIVED, resultName.toStdString(), "");
RimWellLogExtractionCurve* curve = RicWellLogTools::addExtractionCurve(wellPathAnglesTrack, geoMechView, wellPath, nullptr, 0, false, false);
curve->setGeoMechResultAddress(resAddr);
curve->setCurrentTimeStep(geoMechView->currentTimeStep());
curve->setCustomName(resultName);
const QString& resultName = resultNames[i];
RigFemResultAddress resAddr( RIG_WELLPATH_DERIVED, resultName.toStdString(), "" );
RimWellLogExtractionCurve* curve =
RicWellLogTools::addExtractionCurve( wellPathAnglesTrack, geoMechView, wellPath, nullptr, 0, false, false );
curve->setGeoMechResultAddress( resAddr );
curve->setCurrentTimeStep( geoMechView->currentTimeStep() );
curve->setCustomName( resultName );
curve->setColor(colors[i % colors.size()]);
curve->setLineStyle(lineStyles[i % lineStyles.size()]);
curve->setLineThickness(2);
curve->setColor( colors[i % colors.size()] );
curve->setLineStyle( lineStyles[i % lineStyles.size()] );
curve->setLineThickness( 2 );
curve->loadDataAndUpdate( false );
curve->loadDataAndUpdate(false);
double actualMinValue = minValue, actualMaxValue = maxValue;
curve->valueRange(&actualMinValue, &actualMaxValue);
while (maxValue < actualMaxValue)
curve->valueRange( &actualMinValue, &actualMaxValue );
while ( maxValue < actualMaxValue )
{
maxValue += angleIncrement;
}
while (minValue > actualMinValue)
while ( minValue > actualMinValue )
{
minValue -= angleIncrement;
}
maxValue = cvf::Math::clamp(maxValue, angleIncrement, 360.0);
minValue = cvf::Math::clamp(minValue, 0.0, maxValue - 90.0);
maxValue = cvf::Math::clamp( maxValue, angleIncrement, 360.0 );
minValue = cvf::Math::clamp( minValue, 0.0, maxValue - 90.0 );
}
wellPathAnglesTrack->setWidthScaleFactor(RimWellLogTrack::NORMAL_TRACK);
wellPathAnglesTrack->setVisibleXRange(minValue, maxValue);
wellPathAnglesTrack->setTickIntervals(90.0, 30.0);
wellPathAnglesTrack->setXAxisGridVisibility(RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR);
wellPathAnglesTrack->setFormationWellPath(wellPath);
wellPathAnglesTrack->setFormationCase(geoMechView->geoMechCase());
wellPathAnglesTrack->setShowFormations(true);
wellPathAnglesTrack->setShowFormationLabels(false);
wellPathAnglesTrack->setWidthScaleFactor( RimWellLogTrack::NORMAL_TRACK );
wellPathAnglesTrack->setVisibleXRange( minValue, maxValue );
wellPathAnglesTrack->setTickIntervals( 90.0, 30.0 );
wellPathAnglesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
wellPathAnglesTrack->setFormationWellPath( wellPath );
wellPathAnglesTrack->setFormationCase( geoMechView->geoMechCase() );
wellPathAnglesTrack->setShowFormations( true );
wellPathAnglesTrack->setShowFormationLabels( false );
}

View File

@ -1,17 +1,17 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@ -22,11 +22,11 @@
class RimGeoMechCase;
class RimGeoMechView;
class RimWellLogPlot;
class RimWellBoreStabilityPlot;
class RimWellPath;
//==================================================================================================
///
///
//==================================================================================================
class RicNewWellBoreStabilityPlotFeature : public caf::CmdFeature
{
@ -39,8 +39,8 @@ protected:
void setupActionLook( QAction* actionToSetup ) override;
private:
void createFormationTrack(RimWellLogPlot* plot, RimWellPath* wellPath, RimGeoMechCase* geoMechCase);
void createCasingShoeTrack(RimWellLogPlot* plot, RimWellPath* wellPath, RimGeoMechCase* geoMechCase);
void createStabilityCurvesTrack(RimWellLogPlot* plot, RimWellPath* wellPath, RimGeoMechView* geoMechCase);
void createAnglesTrack(RimWellLogPlot* plot, RimWellPath* wellPath, RimGeoMechView* geoMechView);
void createFormationTrack( RimWellBoreStabilityPlot* plot, RimWellPath* wellPath, RimGeoMechCase* geoMechCase );
void createCasingShoeTrack( RimWellBoreStabilityPlot* plot, RimWellPath* wellPath, RimGeoMechCase* geoMechCase );
void createStabilityCurvesTrack( RimWellBoreStabilityPlot* plot, RimWellPath* wellPath, RimGeoMechView* geoMechCase );
void createAnglesTrack( RimWellBoreStabilityPlot* plot, RimWellPath* wellPath, RimGeoMechView* geoMechView );
};

View File

@ -2,17 +2,17 @@
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
//
// 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@ -21,6 +21,7 @@
#include "RimMainPlotCollection.h"
#include "RimProject.h"
#include "RimWellBoreStabilityPlot.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotCollection.h"
#include "RimWellLogTrack.h"
@ -32,31 +33,34 @@
#include <QString>
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot(bool showAfterCreation, const QString& plotDescription)
RimWellBoreStabilityPlot*
RicNewWellLogPlotFeatureImpl::createWellBoreStabilityPlot( bool showAfterCreation /*= true*/,
const QString& plotDescription /*= QString("")*/ )
{
RimWellLogPlotCollection* wellLogPlotColl = wellLogPlotCollection();
CVF_ASSERT(wellLogPlotColl);
CVF_ASSERT( wellLogPlotColl );
// Make sure the summary plot window is created
RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
RimWellLogPlot* plot = new RimWellLogPlot();
RimWellBoreStabilityPlot* plot = new RimWellBoreStabilityPlot();
plot->setAsPlotMdiWindow();
wellLogPlotColl->wellLogPlots().push_back(plot);
if (!plotDescription.isEmpty())
wellLogPlotColl->wellLogPlots().push_back( plot );
if ( !plotDescription.isEmpty() )
{
plot->setDescription(plotDescription);
plot->setDescription( plotDescription );
}
else
{
plot->setDescription(QString("Well Log Plot %1").arg(wellLogPlotCollection()->wellLogPlots.size()));
plot->setDescription(
QString( "Well Bore Stability Plot %1" ).arg( wellLogPlotCollection()->wellLogPlots.size() ) );
}
if (showAfterCreation)
if ( showAfterCreation )
{
RiaGuiApplication::instance()->getOrCreateAndShowMainPlotWindow();
}
@ -65,30 +69,65 @@ RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot(bool showAfterCr
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimWellLogTrack* RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack(bool updateAfter, const QString& trackDescription, RimWellLogPlot* existingPlot)
RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot( bool showAfterCreation, const QString& plotDescription )
{
RimWellLogPlotCollection* wellLogPlotColl = wellLogPlotCollection();
CVF_ASSERT( wellLogPlotColl );
// Make sure the summary plot window is created
RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
RimWellLogPlot* plot = new RimWellLogPlot();
plot->setAsPlotMdiWindow();
wellLogPlotColl->wellLogPlots().push_back( plot );
if ( !plotDescription.isEmpty() )
{
plot->setDescription( plotDescription );
}
else
{
plot->setDescription( QString( "Well Log Plot %1" ).arg( wellLogPlotCollection()->wellLogPlots.size() ) );
}
if ( showAfterCreation )
{
RiaGuiApplication::instance()->getOrCreateAndShowMainPlotWindow();
}
return plot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogTrack* RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( bool updateAfter,
const QString& trackDescription,
RimWellLogPlot* existingPlot )
{
RimWellLogPlot* plot = existingPlot;
if (plot == nullptr)
if ( plot == nullptr )
{
plot = createWellLogPlot();
}
RimWellLogTrack* plotTrack = new RimWellLogTrack();
plot->addTrack(plotTrack);
if (!trackDescription.isEmpty())
plot->addTrack( plotTrack );
if ( !trackDescription.isEmpty() )
{
plotTrack->setDescription(trackDescription);
plotTrack->setDescription( trackDescription );
}
else
{
plotTrack->setDescription(QString("Track %1").arg(plot->trackCount()));
plotTrack->setDescription( QString( "Track %1" ).arg( plot->trackCount() ) );
}
if (updateAfter)
if ( updateAfter )
{
updateAfterCreation(plot);
updateAfterCreation( plot );
}
return plotTrack;
@ -97,9 +136,9 @@ RimWellLogTrack* RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack(bool updat
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellLogPlotFeatureImpl::updateAfterCreation(RimWellLogPlot* plot)
void RicNewWellLogPlotFeatureImpl::updateAfterCreation( RimWellLogPlot* plot )
{
CVF_ASSERT(plot);
CVF_ASSERT( plot );
plot->loadDataAndUpdate();
plot->updateDepthZoom();
plot->updateConnectedEditors();
@ -107,18 +146,18 @@ void RicNewWellLogPlotFeatureImpl::updateAfterCreation(RimWellLogPlot* plot)
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlotCollection* RicNewWellLogPlotFeatureImpl::wellLogPlotCollection()
{
RimProject* project = RiaApplication::instance()->project();
CVF_ASSERT(project);
CVF_ASSERT( project );
RimMainPlotCollection* mainPlotColl = project->mainPlotCollection();
CVF_ASSERT(mainPlotColl);
CVF_ASSERT( mainPlotColl );
RimWellLogPlotCollection* wellLogPlotColl = mainPlotColl->wellLogPlotCollection();
CVF_ASSERT(wellLogPlotColl);
CVF_ASSERT( wellLogPlotColl );
return mainPlotColl->wellLogPlotCollection();
}

View File

@ -2,17 +2,17 @@
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
//
// 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@ -21,19 +21,26 @@
#include <QString>
class RimWellBoreStabilityPlot;
class RimWellLogPlotCollection;
class RimWellLogPlot;
class RimWellLogTrack;
//==================================================================================================
///
///
//==================================================================================================
class RicNewWellLogPlotFeatureImpl
{
public:
static RimWellLogPlot* createWellLogPlot(bool showAfterCreation = true, const QString& plotDescription = QString(""));
static RimWellLogTrack* createWellLogPlotTrack(bool updateAfterCreation = true, const QString& trackDescription = QString(""), RimWellLogPlot* existingPlot = nullptr);
static void updateAfterCreation(RimWellLogPlot* plot);
static RimWellBoreStabilityPlot* createWellBoreStabilityPlot( bool showAfterCreation = true,
const QString& plotDescription = QString( "" ) );
static RimWellLogPlot* createWellLogPlot( bool showAfterCreation = true,
const QString& plotDescription = QString( "" ) );
static RimWellLogTrack* createWellLogPlotTrack( bool updateAfterCreation = true,
const QString& trackDescription = QString( "" ),
RimWellLogPlot* existingPlot = nullptr );
static void updateAfterCreation( RimWellLogPlot* plot );
private:
static RimWellLogPlotCollection* wellLogPlotCollection();
};

View File

@ -75,6 +75,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimPltPlotCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlot.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogTrack.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCurve.h
${CMAKE_CURRENT_LIST_DIR}/RimWellBoreStabilityPlot.h
${CMAKE_CURRENT_LIST_DIR}/RimViewLinker.h
${CMAKE_CURRENT_LIST_DIR}/RimViewLinkerCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimWellLogExtractionCurve.h
@ -210,6 +211,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlotCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimRftPlotCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPltPlotCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellBoreStabilityPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogTrack.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCurve.cpp
${CMAKE_CURRENT_LIST_DIR}/RimViewLinker.cpp

View File

@ -24,6 +24,7 @@
#include "RimCase.h"
#include "RimEclipseCase.h"
#include "RimGeoMechCase.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimWellLogFile.h"
@ -330,6 +331,31 @@ void RimTools::eclipseCaseOptionItems(QList<caf::PdmOptionItemInfo>* options)
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimTools::geoMechCaseOptionItems(QList<caf::PdmOptionItemInfo>* options)
{
CVF_ASSERT(options);
if (!options) return;
RimProject* proj = RiaApplication::instance()->project();
if (proj)
{
std::vector<RimCase*> cases;
proj->allCases(cases);
for (RimCase* c : cases)
{
RimGeoMechCase* geoMechCase = dynamic_cast<RimGeoMechCase*>(c);
if (geoMechCase)
{
options->push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIconProvider()));
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -54,5 +54,6 @@ public:
static void wellPathWithFormations(std::vector<RimWellPath*>* wellPaths);
static void caseOptionItems(QList<caf::PdmOptionItemInfo>* options);
static void eclipseCaseOptionItems(QList<caf::PdmOptionItemInfo>* options);
static void geoMechCaseOptionItems(QList<caf::PdmOptionItemInfo>* options);
static RimWellPathCollection* wellPathCollection();
};

View File

@ -0,0 +1,238 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellBoreStabilityPlot.h"
#include "RigFemPartResultsCollection.h"
#include "RigFemResultAddress.h"
#include "RigGeoMechCaseData.h"
#include "RimGeoMechCase.h"
#include "RimTools.h"
#include "RimWellLogCurveCommonDataSource.h"
#include "RimWellLogFile.h"
#include "cafPdmBase.h"
#include "cafPdmObject.h"
#include "cafPdmUiGroup.h"
namespace caf
{
template<>
void RimWellBoreStabilityPlot::ParameterSourceEnum::setUp()
{
addItem(RigGeoMechWellLogExtractor::AUTO, "AUTO", "Automatic");
addItem(RigGeoMechWellLogExtractor::GRID, "GRID", "Grid");
addItem(RigGeoMechWellLogExtractor::LAS_FILE, "LAS_FILE", "LAS File");
addItem(RigGeoMechWellLogExtractor::ELEMENT_PROPERTY_TABLE, "ELEMENT_PROPERTY_TABLE", "Element Property Table");
addItem(RigGeoMechWellLogExtractor::USER_DEFINED, "USER_DEFINED", "User Defined");
addItem(RigGeoMechWellLogExtractor::HYDROSTATIC_PP, "HYDROSTATIC_PP", "Hydrostatic");
setDefault(RigGeoMechWellLogExtractor::AUTO);
}
} // End namespace caf
CAF_PDM_SOURCE_INIT(RimWellBoreStabilityPlot, "WellBoreStabilityPlot");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellBoreStabilityPlot::RimWellBoreStabilityPlot()
{
CAF_PDM_InitObject("Well Bore Stability Plot", ":/WellLogPlot16x16.png", "", "");
CAF_PDM_InitFieldNoDefault(
&m_porePressureSource, "PorePressureSource", "Pore Pressure", "", "Data source for Pore Pressure", "");
CAF_PDM_InitFieldNoDefault(
&m_poissonRatioSource, "PoissionRatioSource", "Poisson Ratio", "", "Data source for Poisson Ratio", "");
CAF_PDM_InitFieldNoDefault(&m_ucsSource, "UcsSource", "Uniaxial Compressive Strength", "", "Data source for UCS", "");
CAF_PDM_InitField(&m_userDefinedPoissionRatio, "UserPoissionRatio", 0.25, "", "", "User defined Poisson Ratio", "");
m_userDefinedPoissionRatio.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
// Typical UCS: http://ceae.colorado.edu/~amadei/CVEN5768/PDF/NOTES8.pdf
// Typical UCS for Shale is 5 - 100 MPa -> 50 - 1000 bar.
CAF_PDM_InitField(&m_userDefinedUcs, "UserUcs", 100.0, "", "", "User defined UCS [bar]", "");
m_userDefinedUcs.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigGeoMechWellLogExtractor::WbsParameterSource RimWellBoreStabilityPlot::porePressureSource() const
{
return m_porePressureSource();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigGeoMechWellLogExtractor::WbsParameterSource RimWellBoreStabilityPlot::poissonRatioSource() const
{
return m_poissonRatioSource();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigGeoMechWellLogExtractor::WbsParameterSource RimWellBoreStabilityPlot::ucsSource() const
{
return m_ucsSource();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimWellBoreStabilityPlot::userDefinedPoissonRatio() const
{
return m_userDefinedPoissionRatio();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimWellBoreStabilityPlot::userDefinedUcs() const
{
return m_userDefinedUcs();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellBoreStabilityPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
caf::PdmUiGroup* parameterSources = uiOrdering.addNewGroup("Parameter Sources");
parameterSources->add(&m_porePressureSource);
parameterSources->add(&m_poissonRatioSource);
parameterSources->add(&m_userDefinedPoissionRatio, {false, 1, 1});
parameterSources->add(&m_ucsSource);
parameterSources->add(&m_userDefinedUcs, {false, 1, 1});
m_userDefinedPoissionRatio.uiCapability()->setUiReadOnly(m_poissonRatioSource() != RigGeoMechWellLogExtractor::USER_DEFINED);
m_userDefinedUcs.uiCapability()->setUiReadOnly(m_ucsSource() != RigGeoMechWellLogExtractor::USER_DEFINED);
RimWellLogPlot::defineUiOrdering(uiConfigName, uiOrdering);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimWellBoreStabilityPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly)
{
QList<caf::PdmOptionItemInfo> options = RimWellLogPlot::calculateValueOptions(fieldNeedingOptions, useOptionsOnly);
RimWellPath* wellPath = m_commonDataSource->wellPathToApply();
RimGeoMechCase* geoMechCase = dynamic_cast<RimGeoMechCase*>(m_commonDataSource->caseToApply());
int timeStep = m_commonDataSource->timeStepToApply();
RigFemPartResultsCollection* femPartResults = nullptr;
if (geoMechCase)
{
femPartResults = geoMechCase->geoMechData()->femPartResults();
}
if (fieldNeedingOptions == &m_porePressureSource)
{
for (auto source : RigGeoMechWellLogExtractor::supportedSourcesForPorePressure())
{
if (source == RigGeoMechWellLogExtractor::LAS_FILE)
{
if (wellPath && !RimWellLogFile::findMdAndChannelValuesForWellPath(wellPath, "PP").empty())
{
options.push_back(caf::PdmOptionItemInfo(ParameterSourceEnum::uiText(source), source));
}
}
else if (source == RigGeoMechWellLogExtractor::ELEMENT_PROPERTY_TABLE)
{
RigFemResultAddress resAddr(RIG_ELEMENT, "POR", "");
if (timeStep > 0 && femPartResults && !femPartResults->resultValues(resAddr, 0, timeStep).empty())
{
options.push_back(caf::PdmOptionItemInfo(ParameterSourceEnum::uiText(source), source));
}
}
else
{
options.push_back(caf::PdmOptionItemInfo(ParameterSourceEnum::uiText(source), source));
}
}
}
else if (fieldNeedingOptions == &m_poissonRatioSource)
{
for (auto source : RigGeoMechWellLogExtractor::supportedSourcesForPoissonRatio())
{
if (source == RigGeoMechWellLogExtractor::LAS_FILE)
{
if (wellPath && !RimWellLogFile::findMdAndChannelValuesForWellPath(wellPath, "POISSON_RATIO").empty())
{
options.push_back(caf::PdmOptionItemInfo(ParameterSourceEnum::uiText(source), source));
}
}
else if (source == RigGeoMechWellLogExtractor::ELEMENT_PROPERTY_TABLE)
{
RigFemResultAddress resAddr(RIG_ELEMENT, "RATIO", "");
if (timeStep > 0 && femPartResults && !femPartResults->resultValues(resAddr, 0, timeStep).empty())
{
options.push_back(caf::PdmOptionItemInfo(ParameterSourceEnum::uiText(source), source));
}
}
else
{
options.push_back(caf::PdmOptionItemInfo(ParameterSourceEnum::uiText(source), source));
}
}
}
else if (fieldNeedingOptions == &m_ucsSource)
{
for (auto source : RigGeoMechWellLogExtractor::supportedSourcesForUcs())
{
if (source == RigGeoMechWellLogExtractor::LAS_FILE)
{
if (wellPath && !RimWellLogFile::findMdAndChannelValuesForWellPath(wellPath, "UCS").empty())
{
options.push_back(caf::PdmOptionItemInfo(ParameterSourceEnum::uiText(source), source));
}
}
else if (source == RigGeoMechWellLogExtractor::ELEMENT_PROPERTY_TABLE)
{
RigFemResultAddress resAddr(RIG_ELEMENT, "UCS", "");
if (timeStep > 0 && femPartResults && !femPartResults->resultValues(resAddr, 0, timeStep).empty())
{
options.push_back(caf::PdmOptionItemInfo(ParameterSourceEnum::uiText(source), source));
}
}
else
{
options.push_back(caf::PdmOptionItemInfo(ParameterSourceEnum::uiText(source), source));
}
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellBoreStabilityPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue)
{
RimWellLogPlot::fieldChangedByUi(changedField, oldValue, newValue);
if (changedField == &m_porePressureSource || changedField == &m_poissonRatioSource || changedField == &m_ucsSource ||
changedField == &m_userDefinedPoissionRatio || changedField == &m_userDefinedUcs)
{
this->loadDataAndUpdate();
}
}

View File

@ -0,0 +1,67 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimWellLogPlot.h"
#include "RigGeoMechWellLogExtractor.h"
#include "cafAppEnum.h"
#include "cafPdmField.h"
#include "cafPdmPtrField.h"
#include <set>
class RimGeoMechCase;
class RimWellPath;
class RimWellBoreStabilityPlot : public RimWellLogPlot
{
CAF_PDM_HEADER_INIT;
public:
typedef caf::AppEnum<RigGeoMechWellLogExtractor::WbsParameterSource> ParameterSourceEnum;
public:
RimWellBoreStabilityPlot();
RigGeoMechWellLogExtractor::WbsParameterSource porePressureSource() const;
RigGeoMechWellLogExtractor::WbsParameterSource poissonRatioSource() const;
RigGeoMechWellLogExtractor::WbsParameterSource ucsSource() const;
double userDefinedPoissonRatio() const;
double userDefinedUcs() const;
protected:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
private:
caf::PdmField<ParameterSourceEnum> m_porePressureSource;
caf::PdmField<ParameterSourceEnum> m_poissonRatioSource;
caf::PdmField<ParameterSourceEnum> m_ucsSource;
caf::PdmField<double> m_userDefinedPoissionRatio;
caf::PdmField<double> m_userDefinedUcs;
};

View File

@ -2,17 +2,17 @@
//
// Copyright (C) Statoil ASA
// Copyright (C) Ceetron Solutions AS
//
//
// 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@ -26,8 +26,8 @@
#include "cafTensor3.h"
#include "cvfBase.h"
#include "cvfObject.h"
#include "cvfMath.h"
#include "cvfObject.h"
#include "cvfStructGrid.h"
#include "cvfVector3.h"
@ -38,26 +38,49 @@ class RigFemResultAddress;
class RigGeoMechCaseData;
class RigWellPath;
namespace cvf {
class BoundingBox;
namespace cvf
{
class BoundingBox;
}
//==================================================================================================
///
///
//==================================================================================================
class RigGeoMechWellLogExtractor : public RigWellLogExtractor
{
public:
RigGeoMechWellLogExtractor(RigGeoMechCaseData* aCase, const RigWellPath* wellpath, const std::string& wellCaseErrorMsgName);
enum WbsParameterSource
{
AUTO,
GRID, // Only relevant for Pore Pressure
LAS_FILE,
ELEMENT_PROPERTY_TABLE,
USER_DEFINED, // Not relevant for Pore Pressure
HYDROSTATIC_PP // Only relevant for Pore Pressure
};
void curveData(const RigFemResultAddress& resAddr, int frameIndex, std::vector<double>* values );
const RigGeoMechCaseData* caseData();
void setRkbDiff(double rkbDiff);
public:
RigGeoMechWellLogExtractor( RigGeoMechCaseData* aCase,
const RigWellPath* wellpath,
const std::string& wellCaseErrorMsgName );
void setWellLogMdAndMudWeightKgPerM3(const std::vector<std::pair<double, double>>& mudWeightKgPerM3);
void setWellLogMdAndUcsBar(const std::vector<std::pair<double, double>>& ucsValues);
void setWellLogMdAndPoissonRatio(const std::vector<std::pair<double, double>>& poissonRatio);
void curveData( const RigFemResultAddress& resAddr, int frameIndex, std::vector<double>* values );
const RigGeoMechCaseData* caseData();
void setRkbDiff( double rkbDiff );
void setWellLogMdAndMudWeightKgPerM3( const std::vector<std::pair<double, double>>& mudWeightKgPerM3 );
void setWellLogMdAndUcsBar( const std::vector<std::pair<double, double>>& ucsValues );
void setWellLogMdAndPoissonRatio( const std::vector<std::pair<double, double>>& poissonRatio );
static std::set<WbsParameterSource> supportedSourcesForPorePressure();
static std::set<WbsParameterSource> supportedSourcesForPoissonRatio();
static std::set<WbsParameterSource> supportedSourcesForUcs();
void setWbsParameters( WbsParameterSource porePressureSource,
WbsParameterSource poissonRatioSource,
WbsParameterSource ucsSource,
double userDefinedPoissonRatio,
double userDefinedUcs );
private:
enum WellPathTangentCalculation
@ -66,41 +89,58 @@ private:
TangentConstantWithinCell
};
float calculatePorePressureInSegment(int64_t intersectionIdx, float averageSegmentPorePressureBar, double hydroStaticPorePressureBar, double effectiveDepthMeters, const std::vector<float>& poreElementPressuresPascal) const;
float calculatePoissonRatio(int64_t intersectionIdx, const std::vector<float>& poissonRatios) const;
float calculateUcs(int64_t intersectionIdx, const std::vector<float>& ucsValuesPascal) const;
float calculatePorePressureInSegment( int64_t intersectionIdx,
float averageSegmentPorePressureBar,
double hydroStaticPorePressureBar,
double effectiveDepthMeters,
const std::vector<float>& poreElementPressuresPascal ) const;
void wellPathAngles(const RigFemResultAddress& resAddr, std::vector<double>* values);
void wellPathScaledCurveData(const RigFemResultAddress& resAddr, int frameIndex, std::vector<double>* values);
float calculatePoissonRatio( int64_t intersectionIdx, const std::vector<float>& poissonRatios ) const;
float calculateUcs( int64_t intersectionIdx, const std::vector<float>& ucsValuesPascal ) const;
void wellPathAngles( const RigFemResultAddress& resAddr, std::vector<double>* values );
void wellPathScaledCurveData( const RigFemResultAddress& resAddr, int frameIndex, std::vector<double>* values );
void wellBoreWallCurveData(const RigFemResultAddress& resAddr, int frameIndex, std::vector<double>* values);
void wellBoreWallCurveData( const RigFemResultAddress& resAddr, int frameIndex, std::vector<double>* values );
template<typename T>
T interpolateGridResultValue(RigFemResultPosEnum resultPosType, const std::vector<T>& gridResultValues, int64_t intersectionIdx, bool averageNodeElementResults) const;
size_t gridResultIndexFace(size_t elementIdx, cvf::StructGridInterface::FaceType cellFace, int faceLocalNodeIdx) const;
void calculateIntersection();
std::vector<size_t> findCloseCells(const cvf::BoundingBox& bb);
cvf::Vec3d calculateLengthInCell(size_t cellIndex,
const cvf::Vec3d& startPoint,
const cvf::Vec3d& endPoint) const override;
cvf::Vec3d calculateWellPathTangent(int64_t intersectionIdx, WellPathTangentCalculation calculationType) const;
static caf::Ten3d transformTensorToWellPathOrientation(const cvf::Vec3d& wellPathTangent,
const caf::Ten3d& wellPathTensor);
template <typename T>
T interpolateGridResultValue( RigFemResultPosEnum resultPosType,
const std::vector<T>& gridResultValues,
int64_t intersectionIdx,
bool averageNodeElementResults ) const;
size_t gridResultIndexFace( size_t elementIdx, cvf::StructGridInterface::FaceType cellFace, int faceLocalNodeIdx ) const;
void calculateIntersection();
std::vector<size_t> findCloseCells( const cvf::BoundingBox& bb );
cvf::Vec3d calculateLengthInCell( size_t cellIndex,
const cvf::Vec3d& startPoint,
const cvf::Vec3d& endPoint ) const override;
cvf::Vec3d calculateWellPathTangent( int64_t intersectionIdx, WellPathTangentCalculation calculationType ) const;
static caf::Ten3d transformTensorToWellPathOrientation( const cvf::Vec3d& wellPathTangent,
const caf::Ten3d& wellPathTensor );
cvf::Vec3f cellCentroid(size_t intersectionIdx) const;
double getWellLogSegmentValue(size_t intersectionIdx, const std::vector<std::pair<double, double>>& wellLogValues) const;
cvf::Vec3f cellCentroid( size_t intersectionIdx ) const;
double getWellLogSegmentValue( size_t intersectionIdx,
const std::vector<std::pair<double, double>>& wellLogValues ) const;
template <typename T>
bool averageIntersectionValuesToSegmentValue( size_t intersectionIdx,
const std::vector<T>& intersectionValues,
const T& invalidValue,
T* averagedSegmentValue ) const;
static double pascalToBar( double pascalValue );
template<typename T>
bool averageIntersectionValuesToSegmentValue(size_t intersectionIdx, const std::vector<T>& intersectionValues, const T& invalidValue, T* averagedSegmentValue) const;
static double pascalToBar(double pascalValue);
private:
cvf::ref<RigGeoMechCaseData> m_caseData;
double m_rkbDiff;
cvf::ref<RigGeoMechCaseData> m_caseData;
double m_rkbDiff;
std::vector<std::pair<double, double>> m_wellLogMdAndMudWeightKgPerM3;
std::vector<std::pair<double, double>> m_wellLogMdAndUcsBar;
std::vector<std::pair<double, double>> m_wellLogMdAndPoissonRatios;
static const double UNIT_WEIGHT_OF_WATER;
};
WbsParameterSource m_porePressureSource;
WbsParameterSource m_poissonRatioSource;
WbsParameterSource m_ucsSource;
double m_userDefinedPoissonRatio;
double m_userDefinedUcs;
static const double UNIT_WEIGHT_OF_WATER;
};