Merge pull request #5422 from OPM/2019.12-patch.01

Patch release 2019.12.1
This commit is contained in:
Magne Sjaastad 2020-01-28 13:35:17 +01:00 committed by GitHub
commit 7d76a55c0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 271 additions and 72 deletions

View File

@ -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];

View File

@ -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();
@ -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 )
{
@ -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" )
@ -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,
@ -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,

View File

@ -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 )
@ -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;
}
}

View File

@ -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 )
{

View File

@ -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;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -285,16 +304,6 @@ void RimEnsembleCurveSetCollection::deleteAllCurveSets()
m_curveSets.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleCurveSetCollection::setCurrentSummaryCurveSet( RimEnsembleCurveSet* curveSet )
{
m_currentEnsembleCurveSet = curveSet;
updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -47,6 +47,7 @@ public:
void detachQwtCurves();
void reattachQwtCurves();
RimSummaryCurve* findRimCurveFromQwtCurve( const QwtPlotCurve* qwtCurve ) const;
RimEnsembleCurveSet* findRimCurveSetFromQwtCurve( const QwtPlotCurve* qwtCurve ) const;
void addCurveSet( RimEnsembleCurveSet* curveSet );
@ -58,8 +59,6 @@ public:
void deleteAllCurveSets();
void setCurrentSummaryCurveSet( RimEnsembleCurveSet* curveSet );
// Functions related to source stepping
std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar();
void setCurveSetForSourceStepping( RimEnsembleCurveSet* curve );
@ -82,6 +81,5 @@ private:
caf::PdmChildField<RimSummaryPlotSourceStepping*> m_ySourceStepping;
caf::PdmPointer<RimEnsembleCurveSet> m_currentEnsembleCurveSet;
caf::PdmPointer<RimEnsembleCurveSet> m_curveSetForSourceStepping;
};

View File

@ -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;
@ -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() );
}
@ -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 );
@ -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 );
}

View File

@ -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;
@ -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;

View File

@ -112,12 +112,16 @@ public:
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,

View File

@ -29,9 +29,11 @@
#include <Eigen/Core>
#include <Eigen/LU>
#include <iomanip>
#include <QDebug>
#include <fstream>
//--------------------------------------------------------------------------------------------------
///
@ -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;
}

View File

@ -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 )
{

View File

@ -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 );

View File

@ -320,12 +320,12 @@ PdmObjectHandle* PdmReferenceHelper::objectFromFieldReference(PdmFieldHandle* fr
{
if (!fromField) return nullptr;
if (reference.isEmpty()) return nullptr;
if (reference.trimmed().isEmpty()) return nullptr;
QStringList decodedReference = reference.split(QRegExp("\\s+"), QString::SkipEmptyParts);
PdmObjectHandle* lastCommonAnchestor = fromField->ownerObject();
CAF_ASSERT(lastCommonAnchestor);
CAF_ASSERT(decodedReference.size());
while (!decodedReference.empty() && decodedReference.front() == "..")
{
PdmFieldHandle* parentField = lastCommonAnchestor->parentField();

View File

@ -32,6 +32,7 @@ add_executable (${PROJECT_NAME}
cafPdmXmlBasicTest.cpp
cafPdmAdvancedTemplateTest.cpp
cafPdmXmlNumberTest.cpp
cafPdmPtrArrayTest.cpp
)
if (Qt5Core_FOUND)

View File

@ -0,0 +1,153 @@
#include "gtest/gtest.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmObjectHandle.h"
#include "cafPdmReferenceHelper.h"
#include "cafPdmXmlObjectHandle.h"
#include "cafPdmXmlObjectHandleMacros.h"
#include "cafPdmDataValueField.h"
#include "cafPdmPtrArrayField.h"
class MyItemPdmObject : public caf::PdmObjectHandle, public caf::PdmXmlObjectHandle
{
CAF_PDM_XML_HEADER_INIT;
public:
MyItemPdmObject() : PdmObjectHandle(), PdmXmlObjectHandle(this, false)
{
CAF_PDM_XML_InitField(&m_name, "Name");
}
explicit MyItemPdmObject(QString name) : PdmObjectHandle(), PdmXmlObjectHandle(this, false)
{
CAF_PDM_XML_InitField(&m_name, "Name");
m_name = name;
}
~MyItemPdmObject()
{
}
// Fields
caf::PdmDataValueField<QString> m_name;
};
CAF_PDM_XML_SOURCE_INIT(MyItemPdmObject, "MyItemPdmObject");
class MyContainerPdmObject : public caf::PdmObjectHandle, public caf::PdmXmlObjectHandle
{
CAF_PDM_XML_HEADER_INIT;
public:
MyContainerPdmObject() : PdmObjectHandle(), PdmXmlObjectHandle(this, false)
{
CAF_PDM_XML_InitField(&m_items, "Items");
CAF_PDM_XML_InitField(&m_containers, "Containers");
}
~MyContainerPdmObject()
{
}
// Fields
caf::PdmChildArrayField<MyItemPdmObject*> m_items;
caf::PdmPtrArrayField<MyItemPdmObject*> m_containers;
};
CAF_PDM_XML_SOURCE_INIT(MyContainerPdmObject, "MyContainerPdmObject");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(PtrArrayBaseTest, PtrArraySerializeTest)
{
MyContainerPdmObject* objA = new MyContainerPdmObject;
MyItemPdmObject* s1 = new MyItemPdmObject;
MyItemPdmObject* s2 = new MyItemPdmObject;
MyItemPdmObject* s3 = new MyItemPdmObject;
objA->m_items.push_back(s1);
objA->m_items.push_back(s2);
objA->m_items.push_back(s3);
objA->m_containers.push_back(s1);
objA->m_containers.push_back(s2);
objA->m_containers.push_back(s3);
//delete s2;
QString serializedString;
{
serializedString = objA->writeObjectToXmlString();
std::cout << serializedString.toStdString() << std::endl;
}
{
MyContainerPdmObject* ihd1 = new MyContainerPdmObject;
QXmlStreamReader xmlStream(serializedString);
ihd1->readObjectFromXmlString(serializedString, caf::PdmDefaultObjectFactory::instance());
ihd1->resolveReferencesRecursively();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(PtrArrayBaseTest, DeleteObjectPtrArraySerializeTest)
{
MyContainerPdmObject* objA = new MyContainerPdmObject;
MyItemPdmObject* s1 = new MyItemPdmObject;
MyItemPdmObject* s2 = new MyItemPdmObject;
MyItemPdmObject* s3 = new MyItemPdmObject;
objA->m_items.push_back(s1);
objA->m_items.push_back(s2);
objA->m_items.push_back(s3);
objA->m_containers.push_back(s1);
objA->m_containers.push_back(s2);
objA->m_containers.push_back(s3);
delete s2;
QString serializedString;
{
serializedString = objA->writeObjectToXmlString();
std::cout << serializedString.toStdString() << std::endl;
}
{
MyContainerPdmObject* ihd1 = new MyContainerPdmObject;
QXmlStreamReader xmlStream(serializedString);
ihd1->readObjectFromXmlString(serializedString, caf::PdmDefaultObjectFactory::instance());
ihd1->resolveReferencesRecursively();
EXPECT_TRUE(ihd1->m_containers.at(0) != nullptr);
EXPECT_TRUE(ihd1->m_containers.at(1) == nullptr); // Deleted
EXPECT_TRUE(ihd1->m_containers.at(2) == nullptr); // Pointing to item at index 2, does not longer exist
EXPECT_TRUE(ihd1->m_items.size() == size_t(2));
EXPECT_TRUE(ihd1->m_items[0] != nullptr);
EXPECT_TRUE(ihd1->m_items[1] != nullptr);
}
}

View File

@ -1,7 +1,7 @@
set(RESINSIGHT_MAJOR_VERSION 2019)
set(RESINSIGHT_MINOR_VERSION 12)
set(RESINSIGHT_PATCH_VERSION 0)
set(RESINSIGHT_PATCH_VERSION 1)
# Opional text with no restrictions
#set(RESINSIGHT_VERSION_TEXT "-RC05")

View File

@ -1241,7 +1241,7 @@ ecl_smspec_type * ecl_smspec_fread_alloc(const char *header_file, const char * k
'YEARS' as basic time unit; that mode is not supported.
*/
util_abort("%s: Sorry the SMSPEC file seems to lack all time information, need either TIME, or DAY/MONTH/YEAR information. Can not proceed.",__func__);
ecl_smspec_free( ecl_smspec );
return NULL;
}
return ecl_smspec;