Merge branch 'dev' into fishbones

This commit is contained in:
Bjørnar Grip Fjær
2017-06-01 09:02:38 +02:00
33 changed files with 6868 additions and 177 deletions

View File

@@ -322,3 +322,46 @@ exceptions:
CRAVA is a software package for seismic inversion and conditioning of
geological reservoir models. CRAVA is copyrighted by the Norwegian
Computing Center and Statoil and licensed under GPLv3+.
===============================================================================
Notice for opm-flowdiagnostics and opm-flowdiagnostics-applications libraries
===============================================================================
Copyright 2016, 2017 Statoil ASA.
This file is part of the Open Porous Media Project (OPM).
OPM 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.
OPM 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 for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
===============================================================================
Notice for the NightCharts code
===============================================================================
NightCharts
Copyright (C) 2010 by Alexander A. Avdonin, Artem N. Ivanov / ITGears Co.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Please contact gordos.kund@gmail.com with any questions on this license.

View File

@@ -22,8 +22,10 @@
#include "RiaPreferences.h"
#include "RifEclipseSummaryAddress.h"
#include "RifReaderEclipseSummary.h"
#include "RigSingleWellResultsData.h"
#include "RigSummaryCaseData.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseWell.h"
@@ -33,7 +35,7 @@
#include "RimProject.h"
#include "RimSummaryCaseCollection.h"
#include "RimSummaryCurve.h"
#include "RimSummaryCurveFilter.h"
#include "RimSummaryCurveAppearanceCalculator.h"
#include "RimSummaryPlot.h"
#include "RimSummaryPlotCollection.h"
#include "RimView.h"
@@ -94,67 +96,92 @@ void RicPlotProductionRateFeature::onActionTriggered(bool isChecked)
RimGridSummaryCase* gridSummaryCase = RicPlotProductionRateFeature::gridSummaryCaseForWell(well);
if (!gridSummaryCase) continue;
QString curveFilterText = "W*PR:";
QString description = "Well Production Rates : ";
RigSingleWellResultsData* wRes = well->wellResults();
if (wRes)
if (isInjector(well))
{
RimView* rimView = nullptr;
well->firstAncestorOrThisOfTypeAsserted(rimView);
int currentTimeStep = rimView->currentTimeStep();
if (wRes->hasWellResult(currentTimeStep))
{
const RigWellResultFrame& wrf = wRes->wellResultFrame(currentTimeStep);
if ( wrf.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wrf.m_productionType == RigWellResultFrame::GAS_INJECTOR
|| wrf.m_productionType == RigWellResultFrame::WATER_INJECTOR)
{
curveFilterText = "W*IR:";
description = "Well Injection Rates : ";
}
}
description = "Well Injection Rates : ";
}
curveFilterText += well->name();
description += well->name();
RimSummaryPlot* plot = new RimSummaryPlot();
summaryPlotColl->summaryPlots().push_back(plot);
description += well->name();
plot->setDescription(description);
if (isInjector(well))
{
RimSummaryCurveFilter* newCurveFilter = new RimSummaryCurveFilter();
plot->addCurveFilter(newCurveFilter);
// Left Axis
newCurveFilter->createCurves(gridSummaryCase, curveFilterText);
RimDefines::PlotAxis plotAxis = RimDefines::PLOT_AXIS_LEFT;
{
// Note : The parameter "WOIR" is probably never-existing, but we check for existence before creating curve
// Oil
QString parameterName = "WOIR";
RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
plotAxis, RimSummaryCurveAppearanceCalculator::cycledGreenColor(0));
}
{
// Water
QString parameterName = "WWIR";
RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
plotAxis, RimSummaryCurveAppearanceCalculator::cycledBlueColor(0));
}
{
// Gas
QString parameterName = "WGIR";
RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
plotAxis, RimSummaryCurveAppearanceCalculator::cycledRedColor(0));
}
}
else
{
// Left Axis
RimDefines::PlotAxis plotAxis = RimDefines::PLOT_AXIS_LEFT;
{
// Oil
QString parameterName = "WOPR";
RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
plotAxis, RimSummaryCurveAppearanceCalculator::cycledGreenColor(0));
}
{
// Water
QString parameterName = "WWPR";
RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
plotAxis, RimSummaryCurveAppearanceCalculator::cycledBlueColor(0));
}
{
// Gas
QString parameterName = "WGPR";
RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
plotAxis, RimSummaryCurveAppearanceCalculator::cycledRedColor(0));
}
}
// Right Axis
{
RimSummaryCurve* newCurve = new RimSummaryCurve();
plot->addCurve(newCurve);
RimDefines::PlotAxis plotAxis = RimDefines::PLOT_AXIS_RIGHT;
newCurve->setSummaryCase(gridSummaryCase);
{
QString parameterName = "WTHP";
RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
plotAxis, RimSummaryCurveAppearanceCalculator::cycledNoneRGBBrColor(0));
}
RifEclipseSummaryAddress addr( RifEclipseSummaryAddress::SUMMARY_WELL,
"WBHP",
-1,
-1,
"",
well->name().toStdString(),
-1,
"",
-1,
-1,
-1);
newCurve->setSummaryAddress(addr);
newCurve->setYAxis(RimDefines::PlotAxis::PLOT_AXIS_RIGHT);
{
QString parameterName = "WBHP";
RicPlotProductionRateFeature::addSummaryCurve(plot, well, gridSummaryCase, parameterName,
plotAxis, RimSummaryCurveAppearanceCalculator::cycledNoneRGBBrColor(1));
}
}
summaryPlotColl->updateConnectedEditors();
@@ -210,3 +237,71 @@ RimGridSummaryCase* RicPlotProductionRateFeature::gridSummaryCaseForWell(RimEcli
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicPlotProductionRateFeature::isInjector(RimEclipseWell* well)
{
RigSingleWellResultsData* wRes = well->wellResults();
if (wRes)
{
RimView* rimView = nullptr;
well->firstAncestorOrThisOfTypeAsserted(rimView);
int currentTimeStep = rimView->currentTimeStep();
if (wRes->hasWellResult(currentTimeStep))
{
const RigWellResultFrame& wrf = wRes->wellResultFrame(currentTimeStep);
if ( wrf.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wrf.m_productionType == RigWellResultFrame::GAS_INJECTOR
|| wrf.m_productionType == RigWellResultFrame::WATER_INJECTOR)
{
return true;
}
}
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryCurve* RicPlotProductionRateFeature::addSummaryCurve( RimSummaryPlot* plot, const RimEclipseWell* well,
RimGridSummaryCase* gridSummaryCase, const QString& vectorName,
RimDefines::PlotAxis plotAxis, const cvf::Color3f& color)
{
CVF_ASSERT(plot);
CVF_ASSERT(gridSummaryCase);
CVF_ASSERT(well);
RifEclipseSummaryAddress addr(RifEclipseSummaryAddress::SUMMARY_WELL,
vectorName.toStdString(),
-1,
-1,
"",
well->name().toStdString(),
-1,
"",
-1,
-1,
-1);
if (!gridSummaryCase->caseData()->summaryReader()->hasAddress(addr))
{
return nullptr;
}
RimSummaryCurve* newCurve = new RimSummaryCurve();
plot->addCurve(newCurve);
newCurve->setSummaryCase(gridSummaryCase);
newCurve->setSummaryAddress(addr);
newCurve->setColor(color);
newCurve->setYAxis(plotAxis);
return newCurve;
}

View File

@@ -21,9 +21,12 @@
#include "cafCmdFeature.h"
#include "RimFlowDiagSolution.h"
#include "RimDefines.h"
class RimGridSummaryCase;
class RimEclipseWell;
class RimSummaryPlot;
class RimSummaryCurve;
//==================================================================================================
///
@@ -39,7 +42,11 @@ protected:
virtual void setupActionLook( QAction* actionToSetup ) override;
private:
static RimGridSummaryCase* gridSummaryCaseForWell(RimEclipseWell* well);
static RimGridSummaryCase* gridSummaryCaseForWell(RimEclipseWell* well);
static bool isInjector(RimEclipseWell* well);
static RimSummaryCurve* addSummaryCurve(RimSummaryPlot* plot, const RimEclipseWell* well,
RimGridSummaryCase* gridSummaryCase, const QString& vectorName,
RimDefines::PlotAxis plotAxis, const cvf::Color3f& color);
};

View File

@@ -23,6 +23,8 @@
#include "RimEclipseResultCase.h"
#include "RimEclipseView.h"
#include "RimFlowCharacteristicsPlot.h"
#include "RigFlowDiagResults.h"
#include "RimFlowDiagSolution.h"
#include "RimFlowPlotCollection.h"
#include "RimMainPlotCollection.h"
#include "RimProject.h"
@@ -71,6 +73,16 @@ void RicShowFlowCharacteristicsPlotFeature::onActionTriggered(bool isChecked)
if (eclCase && eclCase->defaultFlowDiagSolution())
{
// Make sure flow results for the the active timestep is calculated, to avoid an empty plot
{
RimView * activeView = RiaApplication::instance()->activeReservoirView();
if (activeView && eclCase->defaultFlowDiagSolution()->flowDiagResults())
{
// Trigger calculation
eclCase->defaultFlowDiagSolution()->flowDiagResults()->maxAbsPairFlux(activeView->currentTimeStep());
}
}
if (RiaApplication::instance()->project())
{
RimFlowPlotCollection* flowPlotColl = RiaApplication::instance()->project()->mainPlotCollection->flowPlotCollection();

View File

@@ -971,13 +971,22 @@ RigWellResultPoint RifReaderEclipseOutput::createWellResultPoint(const RigGridBa
resultPoint.m_oilRate = oilRate;
resultPoint.m_waterRate = waterRate;
/// Unit conversion for use with Well Allocation plots
// Convert Gas to oil equivalents
// If field unit, the Gas is in Mega ft^3 while the others are in [stb] (barrel)
// Unused Gas to Barrel conversion
// we convert gas to stb as well. Based on
// 1 [stb] = 0.15898729492800007 [m^3]
// 1 [ft] = 0.3048 [m]
// megaFt3ToStbFactor = 1.0 / (1.0e-6 * 0.15898729492800007 * ( 1.0 / 0.3048 )^3 )
double megaFt3ToStbFactor = 178107.60668;
if (m_eclipseCase->unitsType() == RigEclipseCaseData::UNITS_FIELD) gasRate = megaFt3ToStbFactor * gasRate;
// double megaFt3ToStbFactor = 178107.60668;
double fieldGasToOilEquivalent = 1.0e6/5800; // Mega ft^3 to BOE
double metricGasToOilEquivalent = 1.0/1.0e3; // Sm^3 Gas to Sm^3 oe
if (m_eclipseCase->unitsType() == RigEclipseCaseData::UNITS_FIELD) gasRate = fieldGasToOilEquivalent * gasRate;
if (m_eclipseCase->unitsType() == RigEclipseCaseData::UNITS_METRIC) gasRate = metricGasToOilEquivalent * gasRate;
resultPoint.m_gasRate = gasRate;
}

View File

@@ -141,14 +141,16 @@ QList<caf::PdmOptionItemInfo> RimFlowCharacteristicsPlot::calculateValueOptions(
{
std::vector<RimEclipseResultCase*> cases;
proj->descendantsIncludingThisOfType(cases);
RimEclipseResultCase* defaultCase = nullptr;
for ( RimEclipseResultCase* c : cases )
{
if ( c->defaultFlowDiagSolution() )
{
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIcon()));
if (!defaultCase) defaultCase = c; // Select first
}
}
if (!m_case() && defaultCase) m_case = defaultCase;
}
}
else if ( fieldNeedingOptions == &m_flowDiagSolution )

View File

@@ -357,29 +357,46 @@ std::map<QString, const std::vector<double> *> RimWellAllocationPlot::findReleva
void RimWellAllocationPlot::updateWellFlowPlotXAxisTitle(RimWellLogTrack* plotTrack)
{
RigEclipseCaseData::UnitsType unitSet = m_case->eclipseCaseData()->unitsType();
QString unitText;
switch ( unitSet )
{
case RigEclipseCaseData::UNITS_METRIC:
unitText = "[m^3/day]";
break;
case RigEclipseCaseData::UNITS_FIELD:
unitText = "[Brl/day]";
break;
case RigEclipseCaseData::UNITS_LAB:
unitText = "[cm^3/hr]";
break;
default:
break;
}
if (m_flowDiagSolution)
{
QString unitText;
switch ( unitSet )
{
case RigEclipseCaseData::UNITS_METRIC:
unitText = "[m<sup>3</sup>/day]";
break;
case RigEclipseCaseData::UNITS_FIELD:
unitText = "[Brl/day]";
break;
case RigEclipseCaseData::UNITS_LAB:
unitText = "[cm<sup>3</sup>/hr]";
break;
default:
break;
}
plotTrack->setXAxisTitle("Reservoir Flow Rate " + unitText);
}
else
{
QString unitText;
switch ( unitSet )
{
case RigEclipseCaseData::UNITS_METRIC:
unitText = "[Liquid Sm<sup>3</sup>/day], [Gas kSm<sup>3</sup>/day]";
break;
case RigEclipseCaseData::UNITS_FIELD:
unitText = "[Liquid BBL/day], [Gas BOE/day]";
break;
case RigEclipseCaseData::UNITS_LAB:
unitText = "[cm<sup>3</sup>/hr]";
break;
default:
break;
}
plotTrack->setXAxisTitle("Surface Flow Rate " + unitText);
}
}

View File

@@ -55,19 +55,18 @@ public:
void setupCurveLook(RimSummaryCurve* curve);
private:
static cvf::Color3f cycledPaletteColor(int colorIndex);
static cvf::Color3f cycledNoneRGBBrColor(int colorIndex);
static cvf::Color3f cycledGreenColor(int colorIndex);
static cvf::Color3f cycledBlueColor(int colorIndex);
static cvf::Color3f cycledRedColor(int colorIndex);
static cvf::Color3f cycledBrownColor(int colorIndex);
private:
void setOneCurveAppearance(CurveAppearanceType appeaType, size_t totalCount, int appeaIdx, RimSummaryCurve* curve);
void updateApperanceIndices();
std::map<std::string, size_t> mapNameToAppearanceIndex(CurveAppearanceType & appearance, const std::set<std::string>& names);
cvf::Color3f cycledPaletteColor(int colorIndex);
cvf::Color3f cycledNoneRGBBrColor(int colorIndex);
cvf::Color3f cycledGreenColor(int colorIndex);
cvf::Color3f cycledBlueColor(int colorIndex);
cvf::Color3f cycledRedColor(int colorIndex);
cvf::Color3f cycledBrownColor(int colorIndex);
RimPlotCurve::LineStyleEnum cycledLineStyle(int index);
RimPlotCurve::PointSymbolEnum cycledSymbol(int index);

View File

@@ -74,7 +74,6 @@ public:
const std::vector<double>& pseudoLengthFromTop(size_t branchIdx) const;
const std::vector<double>& trueVerticalDepth(size_t branchIdx) const;
const std::vector<double>& accumulatedTracerFlowPrPseudoLength(const QString& tracerName, size_t branchIdx) const;
const std::vector<double>& flowPrPseudoLength( size_t branchIdx) const;
const std::vector<double>& tracerFlowPrPseudoLength(const QString& tracerName, size_t branchIdx) const;

View File

@@ -21,7 +21,7 @@ namespace RigFlowDiagInterfaceTools {
template <class FluxCalc>
inline Opm::FlowDiagnostics::ConnectionValues
extractFluxField(const Opm::ECLGraph& G,
FluxCalc&& getFlux)
FluxCalc&& getFlux)
{
using ConnVals = Opm::FlowDiagnostics::ConnectionValues;
@@ -52,24 +52,11 @@ namespace RigFlowDiagInterfaceTools {
}
inline Opm::FlowDiagnostics::ConnectionValues
extractFluxField(const Opm::ECLGraph& G,
const Opm::ECLRestartData& rstrt,
const bool compute_fluxes)
extractFluxFieldFromRestartFile(const Opm::ECLGraph& G,
const Opm::ECLRestartData& rstrt)
{
if (compute_fluxes) {
Opm::ECLFluxCalc calc(G);
auto getFlux = [&calc, &rstrt]
(const Opm::ECLGraph::PhaseIndex p)
{
return calc.flux(rstrt, p);
};
return extractFluxField(G, getFlux);
}
auto getFlux = [&G, &rstrt]
(const Opm::ECLGraph::PhaseIndex p)
(const Opm::ECLPhaseIndex p)
{
return G.flux(rstrt, p);
};

View File

@@ -251,9 +251,8 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
Opm::FlowDiagnostics::CellSetValues sumWellFluxPrCell;
{
Opm::FlowDiagnostics::ConnectionValues connectionsVals = RigFlowDiagInterfaceTools::extractFluxField(*(m_opmFlowDiagStaticData->m_eclGraph),
*currentRestartData,
false);
Opm::FlowDiagnostics::ConnectionValues connectionsVals = RigFlowDiagInterfaceTools::extractFluxFieldFromRestartFile(*(m_opmFlowDiagStaticData->m_eclGraph),
*currentRestartData);
m_opmFlowDiagStaticData->m_fldToolbox->assignConnectionFlux(connectionsVals);
@@ -400,7 +399,8 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
{
Graph flowCapStorCapCurve = flowCapacityStorageCapacityCurve(*(injectorSolution.get()),
*(producerSolution.get()),
m_opmFlowDiagStaticData->m_poreVolume);
m_opmFlowDiagStaticData->m_poreVolume,
0.1);
result.setFlowCapStorageCapCurve(flowCapStorCapCurve);
result.setSweepEfficiencyCurve(sweepEfficiency(flowCapStorCapCurve));