Skip to content

Commit

Permalink
Merge pull request #5422 from OPM/2019.12-patch.01
Browse files Browse the repository at this point in the history
Patch release 2019.12.1
  • Loading branch information
magnesj authored Jan 28, 2020
2 parents 823e2ab + 308376e commit 7d76a55
Show file tree
Hide file tree
Showing 17 changed files with 271 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,10 @@ void RicExportFractureCompletionsImpl::getWellPressuresAndInitialProductionTimeS
if ( resultCase )
{
std::vector<QDateTime> caseTimeSteps = resultCase->timeStepDates();
QDateTime initialProductionDate;
QDateTime currentDate;
if ( caseTimeSteps.empty() ) return;

QDateTime initialProductionDate;
QDateTime currentDate;
if ( currentTimeStep < static_cast<int>( caseTimeSteps.size() ) )
{
currentDate = caseTimeSteps[currentTimeStep];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,27 +504,6 @@ RigCompletionData RicWellPathExportCompletionDataFeatureImpl::combineEclipseCell
resultCompletion.setSecondOrderingValue( firstCompletion.secondOrderingValue() );
resultCompletion.setSourcePdmObject( firstCompletion.sourcePdmObject() );

bool anyNonDarcyFlowPresent = false;
for ( const auto& c : completions )
{
if ( c.isNonDarcyFlow() ) anyNonDarcyFlowPresent = true;
}

if ( anyNonDarcyFlowPresent && completions.size() > 1 )
{
QString errorMessage =
QString( "Cannot combine multiple completions when Non-Darcy Flow contribution is present in same cell %1" )
.arg( cellIndexIJK.oneBasedLocalCellIndexString() );
RiaLogging::error( errorMessage );
resultCompletion.addMetadata( "ERROR", errorMessage );
return resultCompletion; // Returning empty completion, should not be exported
}

if ( firstCompletion.isNonDarcyFlow() )
{
return firstCompletion;
}

// completion type, skin factor, well bore diameter and cell direction are taken from (first) main bore,
// if no main bore they are taken from first completion
double skinfactor = firstCompletion.skinFactor();
Expand All @@ -541,11 +520,13 @@ RigCompletionData RicWellPathExportCompletionDataFeatureImpl::combineEclipseCell
skinfactor = completion.skinFactor();
wellBoreDiameter = completion.diameter();
cellDirection = completion.direction();
break;
}
}

double totalTrans = 0.0;
RiaWeightedMeanCalculator<double> dFactorCalculator;

double combinedTrans = 0.0;
double combinedKh = 0.0;

for ( const RigCompletionData& completion : completions )
{
Expand All @@ -554,15 +535,6 @@ RigCompletionData RicWellPathExportCompletionDataFeatureImpl::combineEclipseCell
completion.m_metadata.begin(),
completion.m_metadata.end() );

if ( completion.completionType() != firstCompletion.completionType() )
{
QString errorMessage = QString( "Cannot combine completions of different types in same cell %1" )
.arg( cellIndexIJK.oneBasedLocalCellIndexString() );
RiaLogging::error( errorMessage );
resultCompletion.addMetadata( "ERROR", errorMessage );
return resultCompletion; // Returning empty completion, should not be exported
}

if ( completion.wellName() != firstCompletion.wellName() )
{
QString errorMessage = QString( "Cannot combine completions of different types in same cell %1" )
Expand All @@ -581,12 +553,21 @@ RigCompletionData RicWellPathExportCompletionDataFeatureImpl::combineEclipseCell
return resultCompletion; // Returning empty completion, should not be exported
}

totalTrans = totalTrans + completion.transmissibility();
combinedTrans = combinedTrans + completion.transmissibility();
combinedKh = combinedKh + completion.kh();

dFactorCalculator.addValueAndWeight( completion.dFactor(), completion.transmissibility() );
}

// Arithmetic MEAN dFactor weighted by Tj/SumTj from the completions
// Note : Divide by n is intentional, based on input from @hhgs in mail dated 18.01.2020
double combinedDFactor = dFactorCalculator.weightedMean() / completions.size();

if ( settings.compdatExport == RicExportCompletionDataSettingsUi::TRANSMISSIBILITIES )
{
resultCompletion.setCombinedValuesExplicitTrans( totalTrans,
resultCompletion.setCombinedValuesExplicitTrans( combinedTrans,
combinedKh,
combinedDFactor,
skinfactor,
wellBoreDiameter,
cellDirection,
Expand All @@ -603,8 +584,10 @@ RigCompletionData RicWellPathExportCompletionDataFeatureImpl::combineEclipseCell
.globalCellIndex(),
cellDirection );

double wpimult = totalTrans / transmissibilityEclipseCalculation;
double wpimult = combinedTrans / transmissibilityEclipseCalculation;
resultCompletion.setCombinedValuesImplicitTransWPImult( wpimult,
combinedKh,
combinedDFactor,
skinfactor,
wellBoreDiameter,
cellDirection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,15 +307,18 @@ void RicWellPathExportMswCompletionsImpl::generateWelsegsTable( RifTextDataTable
double depth = 0;
double length = 0;

double midPointMD = 0.5 * ( location->startMD() + location->endMD() );
double midPointTVD = 0.5 * ( location->startTVD() + location->endTVD() );

if ( exportInfo.lengthAndDepthText() == QString( "INC" ) )
{
depth = location->endTVD() - prevTVD;
length = location->endMD() - prevMD;
depth = midPointTVD - prevTVD;
length = midPointMD - prevMD;
}
else
{
depth = location->endTVD();
length = location->endMD();
depth = midPointTVD;
length = midPointMD;
}

if ( location->subIndex() != cvf::UNDEFINED_SIZE_T )
Expand All @@ -333,8 +336,8 @@ void RicWellPathExportMswCompletionsImpl::generateWelsegsTable( RifTextDataTable
formatter.add( exportInfo.linerDiameter() );
formatter.add( exportInfo.roughnessFactor() );
formatter.rowCompleted();
prevMD = location->endMD();
prevTVD = location->endTVD();
prevMD = midPointMD;
prevTVD = midPointTVD;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ RimEnsembleCurveSet::~RimEnsembleCurveSet()
if ( parentPlot && parentPlot->viewer() )
{
m_qwtPlotCurveForLegendText->detach();
parentPlot->viewer()->removeOverlayFrame( m_legendOverlayFrame );
if ( m_legendOverlayFrame )
{
parentPlot->viewer()->removeOverlayFrame( m_legendOverlayFrame );
}
}
if ( m_legendOverlayFrame )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,25 @@ void RimEnsembleCurveSetCollection::reattachQwtCurves()
}
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryCurve* RimEnsembleCurveSetCollection::findRimCurveFromQwtCurve( const QwtPlotCurve* qwtCurve ) const
{
for ( RimEnsembleCurveSet* curveSet : m_curveSets )
{
for ( RimSummaryCurve* rimCurve : curveSet->curves() )
{
if ( rimCurve->qwtPlotCurve() == qwtCurve )
{
return rimCurve;
}
}
}

return nullptr;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -285,16 +304,6 @@ void RimEnsembleCurveSetCollection::deleteAllCurveSets()
m_curveSets.deleteAllChildObjects();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleCurveSetCollection::setCurrentSummaryCurveSet( RimEnsembleCurveSet* curveSet )
{
m_currentEnsembleCurveSet = curveSet;

updateConnectedEditors();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class RimEnsembleCurveSetCollection : public caf::PdmObject
void detachQwtCurves();
void reattachQwtCurves();

RimSummaryCurve* findRimCurveFromQwtCurve( const QwtPlotCurve* qwtCurve ) const;
RimEnsembleCurveSet* findRimCurveSetFromQwtCurve( const QwtPlotCurve* qwtCurve ) const;

void addCurveSet( RimEnsembleCurveSet* curveSet );
Expand All @@ -58,8 +59,6 @@ class RimEnsembleCurveSetCollection : public caf::PdmObject

void deleteAllCurveSets();

void setCurrentSummaryCurveSet( RimEnsembleCurveSet* curveSet );

// Functions related to source stepping
std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar();
void setCurveSetForSourceStepping( RimEnsembleCurveSet* curve );
Expand All @@ -82,6 +81,5 @@ class RimEnsembleCurveSetCollection : public caf::PdmObject

caf::PdmChildField<RimSummaryPlotSourceStepping*> m_ySourceStepping;

caf::PdmPointer<RimEnsembleCurveSet> m_currentEnsembleCurveSet;
caf::PdmPointer<RimEnsembleCurveSet> m_curveSetForSourceStepping;
};
19 changes: 12 additions & 7 deletions ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,13 +405,11 @@ caf::PdmObject* RimSummaryPlot::findPdmObjectFromQwtCurve( const QwtPlotCurve* q

if ( m_ensembleCurveSetCollection )
{
RimEnsembleCurveSet* foundCurveSet = m_ensembleCurveSetCollection->findRimCurveSetFromQwtCurve( qwtCurve );
RimSummaryCurve* foundCurve = m_ensembleCurveSetCollection->findRimCurveFromQwtCurve( qwtCurve );

if ( foundCurveSet )
if ( foundCurve )
{
m_ensembleCurveSetCollection->setCurrentSummaryCurveSet( foundCurveSet );

return foundCurveSet;
return foundCurve;
}
}
return nullptr;
Expand Down Expand Up @@ -1214,7 +1212,7 @@ void RimSummaryPlot::deleteCurves( const std::vector<RimSummaryCurve*>& curves )
if ( curveSet->curves().empty() )
{
if ( curveSet->colorMode() == RimEnsembleCurveSet::ColorMode::BY_ENSEMBLE_PARAM &&
m_plotWidget )
m_plotWidget && curveSet->legendFrame() )
{
m_plotWidget->removeOverlayFrame( curveSet->legendFrame() );
}
Expand Down Expand Up @@ -2199,8 +2197,13 @@ void populateSummaryCurvesData( std::vector<RimSummaryCurve*> curves, SummaryCur
errorCurveData.values = errorValues;
}

if ( casePosInList == cvf::UNDEFINED_SIZE_T )
if ( casePosInList == cvf::UNDEFINED_SIZE_T ||
curve->summaryAddressY().category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED )
{
// Create a section with separate time axis data if
// 1. Case is not referenced before, or
// 2. We have calculated data, and it we cannot assume identical time axis

auto curveDataList = std::vector<CurveData>( {curveData} );
if ( hasErrorData ) curveDataList.push_back( errorCurveData );

Expand All @@ -2210,6 +2213,8 @@ void populateSummaryCurvesData( std::vector<RimSummaryCurve*> curves, SummaryCur
}
else
{
// Append curve data to previously created curvesdata object

curvesData->allCurveData[casePosInList].push_back( curveData );
if ( hasErrorData ) curvesData->allCurveData[casePosInList].push_back( errorCurveData );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,16 @@ void RigCompletionData::setTransAndWPImultBackgroundDataFromPerforation( double
///
//==================================================================================================
void RigCompletionData::setCombinedValuesExplicitTrans( double transmissibility,
double kh,
double dFactor,
double skinFactor,
double diameter,
CellDirection celldirection,
CompletionType completionType )
{
m_transmissibility = transmissibility;
m_kh = kh;
m_dFactor = dFactor;
m_skinFactor = skinFactor;
m_diameter = diameter;
m_direction = celldirection;
Expand All @@ -220,12 +224,16 @@ void RigCompletionData::setCombinedValuesExplicitTrans( double transmiss
///
//==================================================================================================
void RigCompletionData::setCombinedValuesImplicitTransWPImult( double wpimult,
double kh,
double dFactor,
double skinFactor,
double diameter,
CellDirection celldirection,
CompletionType completionType )
{
m_wpimult = wpimult;
m_kh = kh;
m_dFactor = dFactor;
m_direction = celldirection;
m_completionType = completionType;
m_skinFactor = skinFactor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,16 @@ class RigCompletionData
CellDirection direction );

void setCombinedValuesExplicitTrans( double transmissibility,
double kh,
double dFactor,
double skinFactor,
double diameter,
CellDirection celldirection,
CompletionType completionType );

void setCombinedValuesImplicitTransWPImult( double wpimult,
double kh,
double dFactor,
double skinFactor,
double diameter,
CellDirection celldirection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@

#include <Eigen/Core>
#include <Eigen/LU>

#include <iomanip>

#include <QDebug>
#include <fstream>

//--------------------------------------------------------------------------------------------------
///
Expand Down Expand Up @@ -350,8 +352,21 @@ void RigTransmissibilityCondenser::calculateCondensedTransmissibilities()
}
else
{
MatrixXd Tei = totalSystem.bottomLeftCorner( externalEquationCount, internalEquationCount );
m_TiiInv = totalSystem.topLeftCorner( internalEquationCount, internalEquationCount ).inverse();
MatrixXd Tei = totalSystem.bottomLeftCorner( externalEquationCount, internalEquationCount );
MatrixXd Tii = totalSystem.topLeftCorner( internalEquationCount, internalEquationCount );

// std::ofstream outFileStream( "D:\\Data\\TestData\\TiiMatrix.txt" );
// outFileStream << Tii;

Eigen::FullPivLU<MatrixXd> solver( Tii );

// outFileStream << std::endl;
// outFileStream << "Rows x Cols: " << Tii.rows() << "x" << Tii.cols() << std::endl;
// outFileStream << "Invertible: " << ( solver.isInvertible() ? "True" : "False" ) << std::endl;
// outFileStream << "Condition: " << solver.rcond() << std::endl;
// outFileStream << "Rank: " << solver.rank() << std::endl;

m_TiiInv = solver.inverse();
m_Tie = totalSystem.topRightCorner( internalEquationCount, externalEquationCount );
condensedSystem = Tee - Tei * m_TiiInv * m_Tie;
}
Expand Down
17 changes: 15 additions & 2 deletions ApplicationCode/ReservoirDataModel/RigCaseCellResultCalculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,27 @@ bool RigCaseCellResultCalculator::computeDifference( RigEclipseCaseData*
const std::vector<double>& srcVals = srcFrames[fIdx];
std::vector<double>& dstVals = diffResultFrames->at( fIdx );

// Clear the values, and resize with infinity as default value
dstVals.clear();
dstVals.resize( srcVals.size(), std::numeric_limits<double>::infinity() );
}
}

size_t baseFrameCount = baseCaseResults->cellScalarResults( nativeAddress ).size();
size_t sourceFrameCount = sourceCaseResults->cellScalarResults( nativeAddress ).size();
size_t maxFrameCount = std::min( baseFrameCount, sourceFrameCount );
size_t maxGridCount = std::min( baseMainGrid->gridCount(), sourceMainGrid->gridCount() );
size_t maxFrameCount = 0;
if ( address.isTimeLapse() )
{
// We have one defined time step for base case, loop over all source time steps
maxFrameCount = sourceFrameCount;
}
else
{
// We compare cases, diff is computed time index by time index. Use minimum frame count.
maxFrameCount = std::min( baseFrameCount, sourceFrameCount );
}

size_t maxGridCount = std::min( baseMainGrid->gridCount(), sourceMainGrid->gridCount() );

for ( size_t gridIdx = 0; gridIdx < maxGridCount; ++gridIdx )
{
Expand Down
2 changes: 2 additions & 0 deletions ApplicationCode/UserInterface/RiuQwtPlotWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,8 @@ void RiuQwtPlotWidget::addOverlayFrame( QFrame* overlayFrame )
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotWidget::removeOverlayFrame( QFrame* overlayFrame )
{
CAF_ASSERT( overlayFrame );

overlayFrame->hide();
overlayFrame->setParent( nullptr );
m_overlayFrames.removeOne( overlayFrame );
Expand Down
Loading

0 comments on commit 7d76a55

Please sign in to comment.