Result Divided by Area: Establish concept used to compute flow velocity and normalized trans (#7349)

* Geometry Tools : Add convenience functions for polygon area

* #7232 Result Divided by Area: Add cell face result and show in GUI

Native support for flow rate is given by mass rate (mass per time) over a cell face. Add a derived result that takes flow rate divided by cell face area to get velocity (distance per time).

Add support for this concept on relevant native results, and indicate this result type in UI using a "/A" postfix

* Speed up divided-by-area calculations by using openmp

* Some refactoring of result data access.

* Make sure NNC data is scaled correctly in vector flow viz.

Co-authored-by: jonjenssen <jon@soundsoft.no>
This commit is contained in:
Magne Sjaastad
2021-02-11 03:01:17 +01:00
committed by GitHub
parent 424f66fd4e
commit cc292b197a
30 changed files with 631 additions and 321 deletions

View File

@@ -71,7 +71,7 @@ RimEclipsePropertyFilter::RimEclipsePropertyFilter()
CAF_PDM_InitFieldNoDefault( &m_resultDefinition, "ResultDefinition", "Result Definition", "", "", "" );
m_resultDefinition = new RimEclipseResultDefinition();
m_resultDefinition->setDiffResultOptionsEnabled( true );
m_resultDefinition->enableDeltaResults( true );
// Set to hidden to avoid this item to been displayed as a child item
// Fields in this object are displayed using defineUiOrdering()

View File

@@ -162,8 +162,8 @@ void RimGridCrossPlotDataSet::setCellFilterView( RimGridView* cellFilterView )
RigEclipseResultAddress resAddr = eclipseView->cellResult()->eclipseResultAddress();
if ( resAddr.isValid() )
{
m_xAxisProperty->setResultType( resAddr.m_resultCatType );
m_xAxisProperty->setResultVariable( resAddr.m_resultName );
m_xAxisProperty->setResultType( resAddr.resultCatType() );
m_xAxisProperty->setResultVariable( resAddr.resultName() );
m_yAxisProperty->setResultType( RiaDefines::ResultCatType::STATIC_NATIVE );
m_yAxisProperty->setResultVariable( "DEPTH" );
m_timeStep = eclipseView->currentTimeStep();

View File

@@ -408,7 +408,7 @@ QString Rim3dOverlayInfoConfig::resultInfoText( const RigHistogramData& histData
if ( isResultsInfoRelevant )
{
QString propName = eclipseView->cellResult()->resultVariableUiShortName();
QString diffResString = eclipseView->cellResult()->diffResultUiName();
QString diffResString = eclipseView->cellResult()->additionalResultText();
if ( !contourMap->contourMapProjection()->isColumnResult() )
{
infoText += QString( "<b>Cell Property:</b> %1<br>" ).arg( propName );
@@ -443,7 +443,7 @@ QString Rim3dOverlayInfoConfig::resultInfoText( const RigHistogramData& histData
if ( isResultsInfoRelevant )
{
QString propName = eclipseView->cellResult()->resultVariableUiShortName();
QString diffResString = eclipseView->cellResult()->diffResultUiName();
QString diffResString = eclipseView->cellResult()->additionalResultText();
QString timeRangeText = m_statisticsTimeRange().uiText();
if ( eclipseView->cellResult()->isFlowDiagOrInjectionFlooding() )
{

View File

@@ -720,7 +720,7 @@ bool RimEclipseCase::ensureNncDataIsComputed()
RigEclipseCaseData* rigEclipseCase = eclipseCaseData();
if ( rigEclipseCase && rigEclipseCase->mainGrid() )
{
computedData = rigEclipseCase->mainGrid()->nncData()->ensureConnectionDataIsProcecced();
computedData = rigEclipseCase->mainGrid()->nncData()->ensureConnectionDataIsProcessed();
}
return computedData;

View File

@@ -97,7 +97,7 @@ void RimEclipseCellColors::fieldChangedByUi( const caf::PdmFieldHandle* changedF
{
if ( oldValue != newValue )
{
changeLegendConfig( this->resultVariable() );
changeLegendConfig( this->resultVariableUiName() );
}
if ( newValue != RiaResultNames::undefinedResultName() )
@@ -187,6 +187,7 @@ RimRegularLegendConfig* RimEclipseCellColors::createLegendForResult( const QStri
if ( resultName.contains( s, Qt::CaseInsensitive ) )
{
useLog = true;
break;
}
}
}
@@ -290,7 +291,7 @@ void RimEclipseCellColors::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeO
//--------------------------------------------------------------------------------------------------
void RimEclipseCellColors::updateLegendCategorySettings()
{
changeLegendConfig( this->resultVariable() );
changeLegendConfig( this->resultVariableUiName() );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -48,7 +48,7 @@ RimEclipseFaultColors::RimEclipseFaultColors()
"" );
m_customFaultResultColors = new RimEclipseCellColors();
m_customFaultResultColors.uiCapability()->setUiHidden( true );
m_customFaultResultColors->setDiffResultOptionsEnabled( true );
m_customFaultResultColors->enableDeltaResults( true );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -101,7 +101,7 @@ CAF_PDM_SOURCE_INIT( RimEclipseResultDefinition, "ResultDefinition" );
///
//--------------------------------------------------------------------------------------------------
RimEclipseResultDefinition::RimEclipseResultDefinition( caf::PdmUiItemInfo::LabelPosType labelPosition )
: m_diffResultOptionsEnabled( false )
: m_isDeltaResultEnabled( false )
, m_labelPosition( labelPosition )
, m_ternaryEnabled( true )
{
@@ -135,6 +135,8 @@ RimEclipseResultDefinition::RimEclipseResultDefinition( caf::PdmUiItemInfo::Labe
CAF_PDM_InitFieldNoDefault( &m_differenceCase, "DifferenceCase", "Difference Case", "", "", "" );
CAF_PDM_InitField( &m_divideByCellFaceArea, "DivideByCellFaceArea", false, "Divide By Area", "", "", "" );
// One single tracer list has been split into injectors and producers.
// The old list is defined as injectors and we'll have to move any producers in old projects.
CAF_PDM_InitFieldNoDefault( &m_selectedTracers_OBSOLETE, "SelectedTracers", "Tracers", "", "", "" );
@@ -238,6 +240,7 @@ void RimEclipseResultDefinition::simpleCopy( const RimEclipseResultDefinition* o
m_differenceCase = other->m_differenceCase();
m_timeLapseBaseTimestep = other->m_timeLapseBaseTimestep();
m_divideByCellFaceArea = other->m_divideByCellFaceArea();
}
//--------------------------------------------------------------------------------------------------
@@ -376,6 +379,11 @@ void RimEclipseResultDefinition::fieldChangedByUi( const caf::PdmFieldHandle* ch
loadDataAndUpdate();
}
if ( &m_divideByCellFaceArea == changedField )
{
loadDataAndUpdate();
}
if ( &m_flowTracerSelectionMode == changedField )
{
loadDataAndUpdate();
@@ -875,17 +883,21 @@ RigEclipseResultAddress RimEclipseResultDefinition::eclipseResultAddress() const
int timelapseTimeStep = RigEclipseResultAddress::noTimeLapseValue();
int diffCaseId = RigEclipseResultAddress::noCaseDiffValue();
if ( isTimeDiffResult() )
if ( isDeltaTimeStepActive() )
{
timelapseTimeStep = m_timeLapseBaseTimestep();
}
if ( isCaseDiffResult() )
if ( isDeltaCaseActive() )
{
diffCaseId = m_differenceCase->caseId();
}
return RigEclipseResultAddress( m_resultType(), m_resultVariable(), timelapseTimeStep, diffCaseId );
return RigEclipseResultAddress( m_resultType(),
m_resultVariable(),
timelapseTimeStep,
diffCaseId,
isDivideByCellFaceAreaActive() );
}
else
{
@@ -907,16 +919,17 @@ void RimEclipseResultDefinition::setFromEclipseResultAddress( const RigEclipseRe
if ( rinfo ) canonizedAddress = rinfo->eclipseResultAddress();
}
m_resultType = canonizedAddress.m_resultCatType;
m_resultVariable = canonizedAddress.m_resultName;
m_timeLapseBaseTimestep = canonizedAddress.m_timeLapseBaseFrameIdx;
m_resultType = canonizedAddress.resultCatType();
m_resultVariable = canonizedAddress.resultName();
m_timeLapseBaseTimestep = canonizedAddress.deltaTimeStepIndex();
m_divideByCellFaceArea = canonizedAddress.isDivideByCellFaceAreaActive();
if ( canonizedAddress.hasDifferenceCase() )
if ( canonizedAddress.isDeltaCaseActive() )
{
auto eclipseCases = RimProject::current()->eclipseCases();
for ( RimEclipseCase* c : eclipseCases )
{
if ( c && c->caseId() == canonizedAddress.m_differenceCaseId )
if ( c && c->caseId() == canonizedAddress.deltaCaseId() )
{
m_differenceCase = c;
}
@@ -1036,6 +1049,11 @@ QString RimEclipseResultDefinition::resultVariableUiName() const
return flowDiagResUiText( false, 32 );
}
if ( isDivideByCellFaceAreaActive() )
{
return m_resultVariable() + " /A";
}
return m_resultVariable();
}
@@ -1049,74 +1067,62 @@ QString RimEclipseResultDefinition::resultVariableUiShortName() const
return flowDiagResUiText( true, 24 );
}
if ( isDivideByCellFaceAreaActive() )
{
return m_resultVariable() + " /A";
}
return m_resultVariable();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEclipseResultDefinition::diffResultUiName() const
QString RimEclipseResultDefinition::additionalResultText() const
{
QStringList diffResult;
if ( isTimeDiffResult() )
QStringList resultText;
if ( isDeltaTimeStepActive() )
{
std::vector<QDateTime> stepDates;
const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults();
if ( gridCellResults )
{
stepDates = gridCellResults->timeStepDates();
diffResult +=
resultText +=
QString( "<b>Base Time Step</b>: %1" )
.arg( stepDates[m_timeLapseBaseTimestep()].toString( RiaQDateTimeTools::dateFormatString() ) );
}
}
if ( isCaseDiffResult() )
if ( isDeltaCaseActive() )
{
diffResult += QString( "<b>Base Case</b>: %1" ).arg( m_differenceCase()->caseUserDescription() );
resultText += QString( "<b>Base Case</b>: %1" ).arg( m_differenceCase()->caseUserDescription() );
}
return diffResult.join( "\n" );
return resultText.join( "<br>" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEclipseResultDefinition::diffResultUiShortName() const
QString RimEclipseResultDefinition::additionalResultTextShort() const
{
QStringList diffResult;
if ( isTimeDiffResult() || isCaseDiffResult() )
QString resultTextShort;
if ( isDeltaTimeStepActive() || isDeltaCaseActive() )
{
diffResult += QString( "Diff. Options:" );
QStringList resultTextLines;
resultTextLines += QString( "\nDiff. Options:" );
if ( isDeltaCaseActive() )
{
resultTextLines += QString( "Base Case: #%1" ).arg( m_differenceCase()->caseId() );
}
if ( isDeltaTimeStepActive() )
{
resultTextLines += QString( "Base Time: #%1" ).arg( m_timeLapseBaseTimestep() );
}
resultTextShort = resultTextLines.join( "\n" );
}
if ( isCaseDiffResult() )
{
diffResult += QString( "Base Case: #%1" ).arg( m_differenceCase()->caseId() );
}
if ( isTimeDiffResult() )
{
diffResult += QString( "Base Time: #%1" ).arg( m_timeLapseBaseTimestep() );
}
return diffResult.join( "\n" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEclipseResultDefinition::diffResultUiShortNameHTML() const
{
QStringList diffResult;
if ( isTimeDiffResult() || isCaseDiffResult() )
{
diffResult += QString( "<b>Diff. Options:</b>" );
}
if ( isCaseDiffResult() )
{
diffResult += QString( "Base Case: #%1" ).arg( m_differenceCase()->caseId() );
}
if ( isTimeDiffResult() )
{
diffResult += QString( "Base Time: #%1" ).arg( m_timeLapseBaseTimestep() );
}
return diffResult.join( "<br>" );
return resultTextShort;
}
//--------------------------------------------------------------------------------------------------
@@ -1169,7 +1175,7 @@ void RimEclipseResultDefinition::loadResult()
RigCaseCellResultsData* gridCellResults = this->currentGridCellResults();
if ( gridCellResults )
{
if ( isTimeDiffResult() || isCaseDiffResult() )
if ( isDeltaTimeStepActive() || isDeltaCaseActive() || isDivideByCellFaceAreaActive() )
{
gridCellResults->createResultEntry( this->eclipseResultAddress(), false );
}
@@ -1444,9 +1450,9 @@ void RimEclipseResultDefinition::updateUiFieldsFromActiveResult()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseResultDefinition::setDiffResultOptionsEnabled( bool enabled )
void RimEclipseResultDefinition::enableDeltaResults( bool enable )
{
m_diffResultOptionsEnabled = true;
m_isDeltaResultEnabled = enable;
}
//--------------------------------------------------------------------------------------------------
@@ -1563,6 +1569,18 @@ void RimEclipseResultDefinition::defineUiOrdering( QString uiConfigName, caf::Pd
uiOrdering.add( &m_inputPropertyFileName );
}
if ( isDivideByCellFaceAreaPossible() )
{
uiOrdering.add( &m_divideByCellFaceArea );
QString resultPropertyLabel = "Result Property";
if ( isDivideByCellFaceAreaActive() )
{
resultPropertyLabel += QString( "\nDivided by Area" );
}
m_resultVariableUiField.uiCapability()->setUiName( resultPropertyLabel );
}
caf::PdmUiGroup* legendGroup = uiOrdering.addNewGroup( "Legend" );
legendGroup->add( &m_showOnlyVisibleTracersInLegend );
@@ -1570,21 +1588,21 @@ void RimEclipseResultDefinition::defineUiOrdering( QString uiConfigName, caf::Pd
m_resultVariableUiField() == RIG_FLD_MAX_FRACTION_TRACER_RESNAME );
legendGroup->setUiHidden( !showOnlyVisibleTracesOption );
if ( isCaseDiffResultAvailable() || isTimeDiffResultAvailable() )
if ( isDeltaCasePossible() || isDeltaTimeStepPossible() )
{
caf::PdmUiGroup* differenceGroup = uiOrdering.addNewGroup( "Difference Options" );
differenceGroup->setUiReadOnly( !( isTimeDiffResultAvailable() || isCaseDiffResultAvailable() ) );
differenceGroup->setUiReadOnly( !( isDeltaTimeStepPossible() || isDeltaCasePossible() ) );
m_differenceCase.uiCapability()->setUiReadOnly( !isCaseDiffResultAvailable() );
m_timeLapseBaseTimestep.uiCapability()->setUiReadOnly( !isTimeDiffResultAvailable() );
m_differenceCase.uiCapability()->setUiReadOnly( !isDeltaCasePossible() );
m_timeLapseBaseTimestep.uiCapability()->setUiReadOnly( !isDeltaTimeStepPossible() );
if ( isCaseDiffResultAvailable() ) differenceGroup->add( &m_differenceCase );
if ( isTimeDiffResultAvailable() ) differenceGroup->add( &m_timeLapseBaseTimestep );
if ( isDeltaCasePossible() ) differenceGroup->add( &m_differenceCase );
if ( isDeltaTimeStepPossible() ) differenceGroup->add( &m_timeLapseBaseTimestep );
QString resultPropertyLabel = "Result Property";
if ( isTimeDiffResult() || isCaseDiffResult() )
if ( isDeltaTimeStepActive() || isDeltaCaseActive() )
{
resultPropertyLabel += QString( "\n%1" ).arg( diffResultUiShortName() );
resultPropertyLabel += QString( "\n%1" ).arg( additionalResultTextShort() );
}
m_resultVariableUiField.uiCapability()->setUiName( resultPropertyLabel );
}
@@ -2182,9 +2200,9 @@ void RimEclipseResultDefinition::updateRangesForExplicitLegends( RimRegularLegen
void RimEclipseResultDefinition::updateLegendTitle( RimRegularLegendConfig* legendConfig, const QString& legendHeading )
{
QString title = legendHeading + this->resultVariableUiName();
if ( !this->diffResultUiShortName().isEmpty() )
if ( !this->additionalResultTextShort().isEmpty() )
{
title += QString( "\n%1" ).arg( this->diffResultUiShortName() );
title += additionalResultTextShort();
}
if ( this->hasDualPorFractureResult() )
@@ -2565,34 +2583,34 @@ void RimEclipseResultDefinition::syncProducerToInjectorSelection()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEclipseResultDefinition::enableDiffResultOptions() const
bool RimEclipseResultDefinition::isDeltaResultEnabled() const
{
return m_diffResultOptionsEnabled;
return m_isDeltaResultEnabled;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEclipseResultDefinition::isTimeDiffResultAvailable() const
bool RimEclipseResultDefinition::isDeltaTimeStepPossible() const
{
return enableDiffResultOptions() && m_resultTypeUiField() == RiaDefines::ResultCatType::DYNAMIC_NATIVE &&
return isDeltaResultEnabled() && m_resultTypeUiField() == RiaDefines::ResultCatType::DYNAMIC_NATIVE &&
!isTernarySaturationSelected();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEclipseResultDefinition::isTimeDiffResult() const
bool RimEclipseResultDefinition::isDeltaTimeStepActive() const
{
return isTimeDiffResultAvailable() && m_timeLapseBaseTimestep() >= 0;
return isDeltaTimeStepPossible() && m_timeLapseBaseTimestep() >= 0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEclipseResultDefinition::isCaseDiffResultAvailable() const
bool RimEclipseResultDefinition::isDeltaCasePossible() const
{
return enableDiffResultOptions() && !isTernarySaturationSelected() &&
return isDeltaResultEnabled() && !isTernarySaturationSelected() &&
( m_resultTypeUiField() == RiaDefines::ResultCatType::DYNAMIC_NATIVE ||
m_resultTypeUiField() == RiaDefines::ResultCatType::STATIC_NATIVE ||
m_resultTypeUiField() == RiaDefines::ResultCatType::GENERATED );
@@ -2601,9 +2619,49 @@ bool RimEclipseResultDefinition::isCaseDiffResultAvailable() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEclipseResultDefinition::isCaseDiffResult() const
bool RimEclipseResultDefinition::isDeltaCaseActive() const
{
return isCaseDiffResultAvailable() && m_differenceCase() != nullptr;
return isDeltaCasePossible() && m_differenceCase() != nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEclipseResultDefinition::isDivideByCellFaceAreaPossible() const
{
QString str = m_resultVariable;
// TODO : Move to RiaDefines or a separate file for cell face results
if ( str == "FLRWATI+" ) return true;
if ( str == "FLRWATJ+" ) return true;
if ( str == "FLRWATK+" ) return true;
if ( str == "FLROILI+" ) return true;
if ( str == "FLROILJ+" ) return true;
if ( str == "FLROILK+" ) return true;
if ( str == "FLRGASI+" ) return true;
if ( str == "FLRGASJ+" ) return true;
if ( str == "FLRGASK+" ) return true;
if ( str == "TRANX" ) return true;
if ( str == "TRANY" ) return true;
if ( str == "TRANZ" ) return true;
if ( str == "riTRANX" ) return true;
if ( str == "riTRANY" ) return true;
if ( str == "riTRANZ" ) return true;
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEclipseResultDefinition::isDivideByCellFaceAreaActive() const
{
return isDivideByCellFaceAreaPossible() && m_divideByCellFaceArea;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -96,12 +96,10 @@ public:
QString resultVariableUiName() const;
QString resultVariableUiShortName() const;
QString diffResultUiName() const;
QString diffResultUiShortName() const;
QString diffResultUiShortNameHTML() const;
int timeLapseBaseTimeStep() const;
int caseDiffIndex() const;
void enableDeltaResults( bool enable );
int timeLapseBaseTimeStep() const;
int caseDiffIndex() const;
QString additionalResultText() const;
void loadResult();
RigEclipseResultAddress eclipseResultAddress() const;
@@ -127,8 +125,6 @@ public:
void updateUiFieldsFromActiveResult();
void setDiffResultOptionsEnabled( bool enabled );
bool hasDualPorFractureResult();
static QList<caf::PdmOptionItemInfo> calcOptionsForVariableUiFieldStandard( RiaDefines::ResultCatType resultCatType,
@@ -162,11 +158,8 @@ protected:
caf::PdmField<caf::AppEnum<RiaDefines::ResultCatType>> m_resultType;
caf::PdmField<caf::AppEnum<RiaDefines::PorosityModelType>> m_porosityModel;
caf::PdmField<QString> m_resultVariable;
caf::PdmField<int> m_timeLapseBaseTimestep;
caf::PdmField<QString> m_inputPropertyFileName;
caf::PdmPtrField<RimEclipseCase*> m_differenceCase;
caf::PdmPtrField<RimFlowDiagSolution*> m_flowSolution;
caf::PdmField<std::vector<QString>> m_selectedInjectorTracers;
caf::PdmField<std::vector<QString>> m_selectedProducerTracers;
@@ -207,6 +200,10 @@ private:
bool operator()( const QString& lhs, const QString& rhs ) const;
};
caf::PdmField<int> m_timeLapseBaseTimestep;
caf::PdmPtrField<RimEclipseCase*> m_differenceCase;
caf::PdmField<bool> m_divideByCellFaceArea;
private:
void assignFlowSolutionFromCase();
@@ -232,22 +229,26 @@ private:
void syncInjectorToProducerSelection();
void syncProducerToInjectorSelection();
bool enableDiffResultOptions() const;
bool isTimeDiffResultAvailable() const;
bool isTimeDiffResult() const;
bool isCaseDiffResultAvailable() const;
bool isCaseDiffResult() const;
// Delta Case / Delta Time Step / Divide by Cell Face Area
bool isDeltaResultEnabled() const;
bool isDeltaCasePossible() const;
bool isDeltaCaseActive() const;
bool isDeltaTimeStepPossible() const;
bool isDeltaTimeStepActive() const;
bool isDivideByCellFaceAreaPossible() const;
bool isDivideByCellFaceAreaActive() const;
QString additionalResultTextShort() const;
bool showDerivedResultsFirstInVariableUiField() const;
bool addPerCellFaceOptionsForVariableUiField() const;
void ensureProcessingOfObsoleteFields();
bool isTernaryEnabled() const;
QString getInputPropertyFileName( const QString& resultName ) const;
private:
bool m_diffResultOptionsEnabled;
bool m_isDeltaResultEnabled;
caf::PdmUiItemInfo::LabelPosType m_labelPosition;
bool m_ternaryEnabled;
};

View File

@@ -141,7 +141,7 @@ RimEclipseView::RimEclipseView()
"" );
m_cellResult = new RimEclipseCellColors();
m_cellResult.uiCapability()->setUiHidden( true );
m_cellResult->setDiffResultOptionsEnabled( true );
m_cellResult->enableDeltaResults( true );
CAF_PDM_InitFieldNoDefault( &m_cellEdgeResult, "GridCellEdgeResult", "Cell Edge Result", ":/EdgeResult_1.png", "", "" );
m_cellEdgeResult = new RimCellEdgeColors();

View File

@@ -46,16 +46,6 @@ void AppEnum<RimElementVectorResult::TensorColors>::setUp()
setDefault( RimElementVectorResult::TensorColors::RESULT_COLORS );
}
template <>
void AppEnum<RimElementVectorResult::ScaleMethod>::setUp()
{
addItem( RimElementVectorResult::ScaleMethod::RESULT, "RESULT", "Result" );
addItem( RimElementVectorResult::ScaleMethod::RESULT_LOG, "RESULT_LOG", "Result (logarithmic scaling)" );
addItem( RimElementVectorResult::ScaleMethod::CONSTANT, "CONSTANT", "Constant" );
setDefault( RimElementVectorResult::ScaleMethod::RESULT );
}
template <>
void AppEnum<RimElementVectorResult::VectorView>::setUp()
{
@@ -113,7 +103,6 @@ RimElementVectorResult::RimElementVectorResult()
cvf::Color3f defaultUniformColor = cvf::Color3f::BLACK;
CAF_PDM_InitField( &m_uniformVectorColor, "UniformVectorColor", defaultUniformColor, "Uniform Vector Color", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_scaleMethod, "ScaleMethod", "Scale Method", "", "", "" );
CAF_PDM_InitField( &m_sizeScale, "SizeScale", 1.0f, "Size Scale", "", "", "" );
}
@@ -241,14 +230,6 @@ RimElementVectorResult::TensorColors RimElementVectorResult::vectorColors() cons
return m_vectorColor();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimElementVectorResult::ScaleMethod RimElementVectorResult::scaleMethod() const
{
return m_scaleMethod();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -332,6 +313,21 @@ void RimElementVectorResult::mappingRange( double& min, double& max ) const
RigCaseCellResultsData* resultsData =
eclipseView->eclipseCase()->eclipseCaseData()->results( RiaDefines::PorosityModelType::MATRIX_MODEL );
{
// Check if native result is available
// TODO: Refactor all derived results into separate result factory
RigEclipseResultAddress nativeResult = resVarAddr;
nativeResult.enableDivideByCellFaceArea( false );
if ( resultsData->hasResultEntry( nativeResult ) )
{
resultsData->createResultEntry( resVarAddr, false );
}
else
{
continue;
}
}
resultsData->ensureKnownResultLoaded( resVarAddr );
if ( !resultsData->hasResultEntry( resVarAddr ) ) return;
@@ -386,30 +382,34 @@ void RimElementVectorResult::mappingRange( double& min, double& max ) const
for ( size_t flIdx = 0; flIdx < combinedAddresses.size(); flIdx++ )
{
if ( combinedAddresses[flIdx].m_resultCatType == RiaDefines::ResultCatType::DYNAMIC_NATIVE )
if ( combinedAddresses[flIdx].resultCatType() == RiaDefines::ResultCatType::DYNAMIC_NATIVE )
{
if ( m_legendConfig->rangeMode() == RimRegularLegendConfig::RangeModeType::AUTOMATIC_ALLTIMESTEPS )
if ( nncData->generateScalarValues( combinedAddresses[flIdx] ) )
{
const std::vector<std::vector<double>>* nncResultVals =
nncData->dynamicConnectionScalarResult( combinedAddresses[flIdx] );
for ( size_t i = 0; i < nncResultVals->size(); i++ )
if ( m_legendConfig->rangeMode() == RimRegularLegendConfig::RangeModeType::AUTOMATIC_ALLTIMESTEPS )
{
for ( size_t j = 0; j < nncResultVals->at( i ).size(); j++ )
const std::vector<std::vector<double>>* nncResultVals =
nncData->dynamicConnectionScalarResult( combinedAddresses[flIdx] );
for ( size_t i = 0; i < nncResultVals->size(); i++ )
{
max = std::max<double>( max, nncResultVals->at( i ).at( j ) );
min = std::min<double>( min, nncResultVals->at( i ).at( j ) );
for ( size_t j = 0; j < nncResultVals->at( i ).size(); j++ )
{
max = std::max<double>( max, nncResultVals->at( i ).at( j ) );
min = std::min<double>( min, nncResultVals->at( i ).at( j ) );
}
}
}
}
else if ( m_legendConfig->rangeMode() == RimRegularLegendConfig::RangeModeType::AUTOMATIC_CURRENT_TIMESTEP )
{
const std::vector<double>* nncResultVals =
nncData->dynamicConnectionScalarResult( combinedAddresses[flIdx],
static_cast<size_t>( currentTimeStep ) );
for ( size_t i = 0; i < nncResultVals->size(); i++ )
else if ( m_legendConfig->rangeMode() ==
RimRegularLegendConfig::RangeModeType::AUTOMATIC_CURRENT_TIMESTEP )
{
max = std::max<double>( max, nncResultVals->at( i ) );
min = std::min<double>( min, nncResultVals->at( i ) );
const std::vector<double>* nncResultVals =
nncData->dynamicConnectionScalarResult( combinedAddresses[flIdx],
static_cast<size_t>( currentTimeStep ) );
for ( size_t i = 0; i < nncResultVals->size(); i++ )
{
max = std::max<double>( max, nncResultVals->at( i ) );
min = std::min<double>( min, nncResultVals->at( i ) );
}
}
}
}
@@ -511,16 +511,13 @@ void RimElementVectorResult::defineUiOrdering( QString uiConfigName, caf::PdmUiO
visibilityGroup->add( &m_showNncData );
visibilityGroup->add( &m_threshold );
caf::PdmUiGroup* vectorColorsGroup = uiOrdering.addNewGroup( "Vector Colors" );
vectorColorsGroup->add( &m_vectorColor );
caf::PdmUiGroup* apperanceGroup = uiOrdering.addNewGroup( "Appearance" );
apperanceGroup->add( &m_vectorColor );
if ( m_vectorColor == TensorColors::UNIFORM_COLOR )
{
vectorColorsGroup->add( &m_uniformVectorColor );
apperanceGroup->add( &m_uniformVectorColor );
}
caf::PdmUiGroup* vectorSizeGroup = uiOrdering.addNewGroup( "Vector Size" );
vectorSizeGroup->add( &m_sizeScale );
vectorSizeGroup->add( &m_scaleMethod );
apperanceGroup->add( &m_sizeScale );
uiOrdering.skipRemainingFields( true );
}
@@ -547,6 +544,12 @@ bool RimElementVectorResult::resultAddressesCombined( std::vector<RigEclipseResu
addresses.push_back( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE,
RiaResultNames::combinedWaterFluxResultName() ) );
}
for ( auto& adr : addresses )
{
adr.enableDivideByCellFaceArea( true );
}
return addresses.size() > 0;
}
@@ -576,6 +579,11 @@ bool RimElementVectorResult::resultAddressesIJK( std::vector<RigEclipseResultAdd
addresses.push_back( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "FLRWATK+" ) );
}
for ( auto& adr : addresses )
{
adr.enableDivideByCellFaceArea( true );
}
return addresses.size() > 0;
}

View File

@@ -50,13 +50,6 @@ public:
RESULT_COLORS
};
enum class ScaleMethod
{
RESULT,
RESULT_LOG,
CONSTANT
};
enum class VectorView
{
CELL_CENTER_TOTAL,
@@ -87,7 +80,6 @@ public:
float threshold() const;
float sizeScale() const;
TensorColors vectorColors() const;
ScaleMethod scaleMethod() const;
const cvf::Color3f& getUniformVectorColor() const;
const RimRegularLegendConfig* legendConfig() const;
@@ -105,8 +97,6 @@ private:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
static QString fieldNameFromUi( const QString& uiFieldName );
private:
caf::PdmField<bool> m_showResult;
caf::PdmField<bool> m_showOil;
@@ -121,7 +111,6 @@ private:
caf::PdmField<float> m_threshold;
caf::PdmField<caf::AppEnum<TensorColors>> m_vectorColor;
caf::PdmField<cvf::Color3f> m_uniformVectorColor;
caf::PdmField<caf::AppEnum<ScaleMethod>> m_scaleMethod;
caf::PdmField<float> m_sizeScale;
caf::PdmField<RimRegularLegendConfig::RangeModeEnum> m_rangeMode;
caf::PdmChildField<RimRegularLegendConfig*> m_legendConfig;

View File

@@ -373,7 +373,7 @@ void RimHistogramCalculator::updateVisCellStatsIfNeeded( RimEclipseView*
{
RigEclipseResultAddress resAddr = eclResultDefinition->eclipseResultAddress();
QString resultName = resAddr.m_resultName;
QString resultName = resAddr.resultName();
std::vector<RigEclipseResultAddress> addresses = sourcesForMultiPropertyResults( resultName );
if ( addresses.size() )

View File

@@ -355,7 +355,7 @@ void RimSummaryPlotFilterTextCurveSetEditor::fieldChangedByUi( const caf::PdmFie
if ( !( gridCellResults && gridCellResults->resultInfo( cellResAddr.eclipseResultAddress ) ) )
{
RiaLogging::warning( "Could not find a restart result property with name: \"" +
cellResAddr.eclipseResultAddress.m_resultName + "\"" );
cellResAddr.eclipseResultAddress.resultName() + "\"" );
continue;
}