2022-10-07 09:08:50 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2022 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 "RicNewMultiPhaseRftSegmentPlotFeature.h"
|
|
|
|
#include "RicNewRftSegmentWellLogPlotFeature.h"
|
|
|
|
|
|
|
|
#include "RicNewWellLogPlotFeatureImpl.h"
|
|
|
|
#include "RicWellLogPlotCurveFeatureImpl.h"
|
|
|
|
#include "RicWellLogTools.h"
|
|
|
|
|
|
|
|
#include "RiaApplication.h"
|
2022-12-09 01:47:40 -06:00
|
|
|
#include "RiaLogging.h"
|
2022-10-27 04:17:41 -05:00
|
|
|
#include "RiaPlotWindowRedrawScheduler.h"
|
2022-10-07 09:08:50 -05:00
|
|
|
#include "RiaRftDefines.h"
|
|
|
|
|
|
|
|
#include "RifReaderOpmRft.h"
|
|
|
|
|
|
|
|
#include "RimRftCase.h"
|
|
|
|
#include "RimRftTopologyCurve.h"
|
|
|
|
#include "RimSummaryCase.h"
|
|
|
|
#include "RimWellLogPlot.h"
|
2022-10-27 04:17:41 -05:00
|
|
|
#include "RimWellLogRftCurve.h"
|
2022-10-07 09:08:50 -05:00
|
|
|
#include "RimWellLogTrack.h"
|
|
|
|
|
|
|
|
#include "RiuPlotMainWindowTools.h"
|
|
|
|
|
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
|
|
|
CAF_CMD_SOURCE_INIT( RicNewMultiPhaseRftSegmentPlotFeature, "RicNewMultiPhaseRftSegmentPlotFeature" );
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicNewMultiPhaseRftSegmentPlotFeature::isCommandEnabled()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicNewMultiPhaseRftSegmentPlotFeature::onActionTriggered( bool isChecked )
|
|
|
|
{
|
|
|
|
auto rftCase = caf::SelectionManager::instance()->selectedItemOfType<RimRftCase>();
|
|
|
|
if ( !rftCase ) return;
|
|
|
|
|
|
|
|
RimSummaryCase* summaryCase = nullptr;
|
|
|
|
rftCase->firstAncestorOfType( summaryCase );
|
|
|
|
if ( !summaryCase ) return;
|
|
|
|
|
2022-12-09 01:47:40 -06:00
|
|
|
auto rftReader = summaryCase->rftReader();
|
|
|
|
if ( !rftReader )
|
|
|
|
{
|
|
|
|
RiaLogging::error( "Could not open RFT file or no RFT file present. " );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-10-07 09:08:50 -05:00
|
|
|
auto plot = RicNewWellLogPlotFeatureImpl::createHorizontalWellLogPlot();
|
|
|
|
|
|
|
|
QString wellName = "Unknown";
|
|
|
|
|
2022-12-09 01:47:40 -06:00
|
|
|
auto wellNames = rftReader->wellNames();
|
|
|
|
if ( !wellNames.empty() ) wellName = *wellNames.begin();
|
2022-10-07 09:08:50 -05:00
|
|
|
|
2022-10-27 04:17:41 -05:00
|
|
|
appendTrackAndCurveForBranchType( plot,
|
|
|
|
"Connection Rates",
|
|
|
|
{ "CONGRAT", "CONORAT", "CONWRAT" },
|
|
|
|
wellName,
|
|
|
|
RiaDefines::RftBranchType::RFT_ANNULUS,
|
|
|
|
summaryCase );
|
2022-10-07 09:08:50 -05:00
|
|
|
|
|
|
|
{
|
2023-02-26 03:48:40 -06:00
|
|
|
for ( auto branchType :
|
|
|
|
{ RiaDefines::RftBranchType::RFT_ANNULUS, RiaDefines::RftBranchType::RFT_DEVICE, RiaDefines::RftBranchType::RFT_TUBING } )
|
2022-10-27 04:17:41 -05:00
|
|
|
{
|
2023-02-26 03:48:40 -06:00
|
|
|
appendTrackAndCurveForBranchType( plot, "Segment Rates", { "SEGGRAT", "SEGORAT", "SEGWRAT" }, wellName, branchType, summaryCase );
|
2022-10-27 04:17:41 -05:00
|
|
|
}
|
2022-10-07 09:08:50 -05:00
|
|
|
}
|
|
|
|
|
2022-10-27 04:17:41 -05:00
|
|
|
RicNewRftSegmentWellLogPlotFeature::appendPressureTrack( plot, wellName, summaryCase );
|
|
|
|
RicNewRftSegmentWellLogPlotFeature::appendConnectionFactorTrack( plot, wellName, summaryCase );
|
2022-10-07 09:08:50 -05:00
|
|
|
RicNewRftSegmentWellLogPlotFeature::appendTopologyTrack( plot, wellName, summaryCase );
|
|
|
|
|
|
|
|
plot->loadDataAndUpdate();
|
|
|
|
|
2022-10-27 04:17:41 -05:00
|
|
|
RiaPlotWindowRedrawScheduler::instance()->performScheduledUpdatesAndReplots();
|
|
|
|
plot->updateLayout();
|
|
|
|
|
2022-10-07 09:08:50 -05:00
|
|
|
RiuPlotMainWindowTools::onObjectAppended( plot );
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicNewMultiPhaseRftSegmentPlotFeature::appendTrackAndCurveForBranchType( RimWellLogPlot* plot,
|
2022-10-27 04:17:41 -05:00
|
|
|
const QString& trackName,
|
2022-10-07 09:08:50 -05:00
|
|
|
const std::vector<QString>& resultNames,
|
|
|
|
const QString& wellName,
|
|
|
|
RiaDefines::RftBranchType branchType,
|
|
|
|
RimSummaryCase* summaryCase )
|
|
|
|
{
|
2022-10-27 04:17:41 -05:00
|
|
|
auto plotTrack = new RimWellLogTrack();
|
2022-10-07 09:08:50 -05:00
|
|
|
plot->addPlot( plotTrack );
|
2022-10-27 04:17:41 -05:00
|
|
|
plotTrack->setDescription( trackName );
|
2022-10-07 09:08:50 -05:00
|
|
|
|
|
|
|
plot->loadDataAndUpdate();
|
|
|
|
|
|
|
|
for ( const auto& resultName : resultNames )
|
|
|
|
{
|
|
|
|
auto curve = RicWellLogTools::addSummaryRftSegmentCurve( plotTrack, resultName, wellName, branchType, summaryCase );
|
2022-10-12 05:41:08 -05:00
|
|
|
curve->setNamingMethod( RiaDefines::ObjectNamingMethod::TEMPLATE );
|
|
|
|
|
|
|
|
QString templateText = RiaDefines::namingVariableResultName() + ", " + RiaDefines::namingVariableResultType();
|
|
|
|
curve->setCurveNameTemplateText( templateText );
|
|
|
|
|
2022-10-27 04:17:41 -05:00
|
|
|
if ( resultName == "SEGGRAT" || resultName == "CONGRAT" )
|
|
|
|
{
|
|
|
|
curve->setScaleFactor( 1e-3 );
|
|
|
|
}
|
|
|
|
curve->setFillStyle( Qt::SolidPattern );
|
|
|
|
|
2022-10-07 09:08:50 -05:00
|
|
|
curve->setIsStacked( true );
|
|
|
|
curve->loadDataAndUpdate( true );
|
|
|
|
|
|
|
|
curve->updateAllRequiredEditors();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicNewMultiPhaseRftSegmentPlotFeature::setupActionLook( QAction* actionToSetup )
|
|
|
|
{
|
|
|
|
actionToSetup->setText( "Create RFT Multi Phase Segment Plot" );
|
|
|
|
actionToSetup->setIcon( QIcon( ":/WellLogCurve16x16.png" ) );
|
|
|
|
}
|