Additional refactoring for POR-Bar result handling

* Always use element-nodal for POR calculations
* Add RigFemAddressDefines
Add special handling for "POR-Bar" result, always use element_nodal

* 9362 Show unit text "sg" when normalized by hydrostatic pressure
This commit is contained in:
Magne Sjaastad
2023-08-23 13:29:54 +02:00
committed by GitHub
parent 4b12f82583
commit bb293539d5
25 changed files with 203 additions and 88 deletions

View File

@@ -106,6 +106,8 @@ add_library(
RimGeoMechGeometrySelectionItem.cpp
RigFemPartResultCalculatorNodalDisplacement.h
RigFemPartResultCalculatorNodalDisplacement.cpp
RigFemAddressDefines.h
RigFemAddressDefines.cpp
)
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

View File

@@ -0,0 +1,66 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2023- 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 "RigFemAddressDefines.h"
#include "RigFemResultAddress.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::string RigFemAddressDefines::porBar()
{
return "POR-Bar";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFemResultAddress RigFemAddressDefines::getResultLookupAddress( const RigFemResultAddress& sourceAddress )
{
if ( sourceAddress.resultPosType == RIG_NODAL && sourceAddress.fieldName == RigFemAddressDefines::porBar() )
{
// Use element nodal results when using POR-Bar. If nodal results are used, the resulting display will bleed into neighboring
// cells.
//
// https://github.com/OPM/ResInsight/issues/331
// https://github.com/OPM/ResInsight/issues/10488
RigFemResultAddress lookupAddressForPOR = sourceAddress;
lookupAddressForPOR.resultPosType = RIG_ELEMENT_NODAL;
return lookupAddressForPOR;
}
return sourceAddress;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFemResultAddress RigFemAddressDefines::elementNodalPorBarAddress()
{
return RigFemResultAddress( RIG_ELEMENT_NODAL, RigFemAddressDefines::porBar(), "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFemResultAddress RigFemAddressDefines::nodalPorBarAddress()
{
return RigFemResultAddress( RIG_NODAL, RigFemAddressDefines::porBar(), "" );
}

View File

@@ -0,0 +1,33 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2023- 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <string>
class RigFemResultAddress;
namespace RigFemAddressDefines
{
const std::string porBar();
RigFemResultAddress getResultLookupAddress( const RigFemResultAddress& sourceAddress );
RigFemResultAddress elementNodalPorBarAddress();
RigFemResultAddress nodalPorBarAddress();
}; // namespace RigFemAddressDefines

View File

@@ -18,6 +18,7 @@
#include "RigFemPartResultCalculatorBarConverted.h"
#include "RigFemAddressDefines.h"
#include "RigFemPart.h"
#include "RigFemPartCollection.h"
#include "RigFemPartResultsCollection.h"
@@ -63,9 +64,9 @@ bool RigFemPartResultCalculatorBarConverted::isMatching( const RigFemResultAddre
}
// TODO: split in multiple classes??
if ( m_fieldName == "POR-Bar" )
if ( m_fieldName == RigFemAddressDefines::porBar() )
{
return ( ( resVarAddr.fieldName == "POR-Bar" ) && ( resVarAddr.resultPosType == RIG_NODAL ) &&
return ( ( resVarAddr.fieldName == RigFemAddressDefines::porBar() ) && ( resVarAddr.resultPosType == RIG_NODAL ) &&
!( resVarAddr.componentName == "X" || resVarAddr.componentName == "Y" || resVarAddr.componentName == "Z" ) );
}
else

View File

@@ -18,6 +18,7 @@
#include "RigFemPartResultCalculatorEnIpPorBar.h"
#include "RigFemAddressDefines.h"
#include "RigFemPart.h"
#include "RigFemPartCollection.h"
#include "RigFemPartResultsCollection.h"
@@ -48,7 +49,7 @@ RigFemPartResultCalculatorEnIpPorBar::~RigFemPartResultCalculatorEnIpPorBar()
//--------------------------------------------------------------------------------------------------
bool RigFemPartResultCalculatorEnIpPorBar::isMatching( const RigFemResultAddress& resVarAddr ) const
{
return ( resVarAddr.fieldName == "POR-Bar" && resVarAddr.resultPosType != RIG_NODAL );
return ( resVarAddr.fieldName == RigFemAddressDefines::porBar() && resVarAddr.resultPosType != RIG_NODAL );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -18,6 +18,7 @@
#include "RigFemPartResultCalculatorGamma.h"
#include "RigFemAddressDefines.h"
#include "RigFemPart.h"
#include "RigFemPartCollection.h"
#include "RigFemPartResultsCollection.h"
@@ -88,7 +89,7 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorGamma::calculate( int partIn
stepCountProgress.setNextProgressIncrement( m_resultCollection->timeStepCount() );
RigFemScalarResultFrames* srcPORDataFrames =
m_resultCollection->findOrLoadScalarResult( partIndex, RigFemResultAddress( RIG_NODAL, "POR-Bar", "" ) );
m_resultCollection->findOrLoadScalarResult( partIndex, RigFemAddressDefines::nodalPorBarAddress() );
RigFemScalarResultFrames* dstDataFrames = m_resultCollection->createScalarResult( partIndex, resVarAddr );
stepCountProgress.incrementProgress();

View File

@@ -18,6 +18,7 @@
#include "RigFemPartResultCalculatorMudWeightWindow.h"
#include "RigFemAddressDefines.h"
#include "RigFemPart.h"
#include "RigFemPartCollection.h"
#include "RigFemPartGrid.h"
@@ -99,9 +100,8 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorMudWeightWindow::calculate(
// Pore pressure
RigFemScalarResultFrames* porePressureDataFrames = nullptr;
{
auto task = stepCountProgress.task( "Loading POR-Bar.", m_resultCollection->timeStepCount() );
porePressureDataFrames =
m_resultCollection->findOrLoadScalarResult( partIndex, RigFemResultAddress( RIG_ELEMENT_NODAL, "POR-Bar", "" ) );
auto task = stepCountProgress.task( "Loading POR-Bar.", m_resultCollection->timeStepCount() );
porePressureDataFrames = m_resultCollection->findOrLoadScalarResult( partIndex, RigFemAddressDefines::elementNodalPorBarAddress() );
}
// Stress (ST.S3)

View File

@@ -18,6 +18,7 @@
#include "RigFemPartResultCalculatorNodalGradients.h"
#include "RigFemAddressDefines.h"
#include "RigFemPart.h"
#include "RigFemPartCollection.h"
#include "RigFemPartResultsCollection.h"
@@ -49,7 +50,7 @@ RigFemPartResultCalculatorNodalGradients::~RigFemPartResultCalculatorNodalGradie
//--------------------------------------------------------------------------------------------------
bool RigFemPartResultCalculatorNodalGradients::isMatching( const RigFemResultAddress& resVarAddr ) const
{
return ( ( resVarAddr.fieldName == "POR-Bar" ) && ( resVarAddr.resultPosType == RIG_NODAL ) &&
return ( ( resVarAddr.fieldName == RigFemAddressDefines::porBar() ) && ( resVarAddr.resultPosType == RIG_NODAL ) &&
( resVarAddr.componentName == "X" || resVarAddr.componentName == "Y" || resVarAddr.componentName == "Z" ) );
}
@@ -58,7 +59,7 @@ bool RigFemPartResultCalculatorNodalGradients::isMatching( const RigFemResultAdd
//--------------------------------------------------------------------------------------------------
RigFemScalarResultFrames* RigFemPartResultCalculatorNodalGradients::calculate( int partIndex, const RigFemResultAddress& resVarAddr )
{
CVF_ASSERT( resVarAddr.fieldName == "POR-Bar" );
CVF_ASSERT( resVarAddr.fieldName == RigFemAddressDefines::porBar() );
CVF_ASSERT( resVarAddr.componentName == "X" || resVarAddr.componentName == "Y" || resVarAddr.componentName == "Z" );
caf::ProgressInfo stepCountProgress( m_resultCollection->timeStepCount() * 5, "" );
@@ -81,8 +82,8 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorNodalGradients::calculate( i
stepCountProgress.incrementProgress();
stepCountProgress.setNextProgressIncrement( m_resultCollection->timeStepCount() );
RigFemResultAddress porResultAddr( RIG_NODAL, "POR-Bar", "" );
RigFemScalarResultFrames* srcDataFrames = m_resultCollection->findOrLoadScalarResult( partIndex, porResultAddr );
RigFemScalarResultFrames* srcDataFrames =
m_resultCollection->findOrLoadScalarResult( partIndex, RigFemAddressDefines::nodalPorBarAddress() );
stepCountProgress.incrementProgress();

View File

@@ -18,6 +18,7 @@
#include "RigFemPartResultCalculatorNormalST.h"
#include "RigFemAddressDefines.h"
#include "RigFemPart.h"
#include "RigFemPartCollection.h"
#include "RigFemPartResultsCollection.h"
@@ -69,7 +70,7 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorNormalST::calculate( int par
stepCountProgress.setNextProgressIncrement( m_resultCollection->timeStepCount() );
RigFemScalarResultFrames* srcPORDataFrames =
m_resultCollection->findOrLoadScalarResult( partIndex, RigFemResultAddress( RIG_NODAL, "POR-Bar", "" ) );
m_resultCollection->findOrLoadScalarResult( partIndex, RigFemAddressDefines::nodalPorBarAddress() );
RigFemScalarResultFrames* dstDataFrames = m_resultCollection->createScalarResult( partIndex, resVarAddr );
const RigFemPart* femPart = m_resultCollection->parts()->part( partIndex );

View File

@@ -18,6 +18,7 @@
#include "RigFemPartResultCalculatorNormalized.h"
#include "RigFemAddressDefines.h"
#include "RigFemPart.h"
#include "RigFemPartCollection.h"
#include "RigFemPartGrid.h"
@@ -61,9 +62,7 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorNormalized::calculate( int p
{
CVF_ASSERT( resVarAddr.normalizeByHydrostaticPressure() && isNormalizableResult( resVarAddr ) );
RigFemResultAddress unscaledResult = resVarAddr;
if ( unscaledResult.resultPosType == RIG_NODAL && unscaledResult.fieldName == "POR-Bar" )
unscaledResult.resultPosType = RIG_ELEMENT_NODAL;
RigFemResultAddress unscaledResult = RigFemAddressDefines::getResultLookupAddress( resVarAddr );
unscaledResult.normalizedByHydrostaticPressure = false;
CAF_ASSERT( unscaledResult.resultPosType == RIG_ELEMENT_NODAL );
@@ -76,7 +75,7 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorNormalized::calculate( int p
{
auto task = stepCountProgress.task( "Loading POR Result", m_resultCollection->timeStepCount() );
porDataFrames = m_resultCollection->findOrLoadScalarResult( partIndex, RigFemResultAddress( RIG_ELEMENT_NODAL, "POR-Bar", "" ) );
porDataFrames = m_resultCollection->findOrLoadScalarResult( partIndex, RigFemAddressDefines::elementNodalPorBarAddress() );
if ( !porDataFrames ) return nullptr;
}
@@ -86,8 +85,11 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorNormalized::calculate( int p
if ( !srcDataFrames ) return nullptr;
}
{
auto task = stepCountProgress.task( "Creating Space for Normalized Result", m_resultCollection->timeStepCount() );
dstDataFrames = m_resultCollection->createScalarResult( partIndex, RigFemResultAddress( resVarAddr ) );
auto task = stepCountProgress.task( "Creating Space for Normalized Result", m_resultCollection->timeStepCount() );
RigFemResultAddress destResultAddr = RigFemAddressDefines::getResultLookupAddress( resVarAddr );
dstDataFrames = m_resultCollection->createScalarResult( partIndex, destResultAddr );
if ( !dstDataFrames ) return nullptr;
}

View File

@@ -20,6 +20,7 @@
#include "RiaEclipseUnitTools.h"
#include "RigFemAddressDefines.h"
#include "RigFemPart.h"
#include "RigFemPartCollection.h"
#include "RigFemPartResultsCollection.h"
@@ -78,7 +79,7 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorPoreCompressibility::calcula
return result;
};
RigFemScalarResultFrames* srcPORDataFrames = loadFrameLambda( RigFemResultAddress( RIG_NODAL, "POR-Bar", "" ) );
RigFemScalarResultFrames* srcPORDataFrames = loadFrameLambda( RigFemAddressDefines::nodalPorBarAddress() );
// Volumetric Strain
RigFemScalarResultFrames* srcEVDataFrames = loadFrameLambda( RigFemResultAddress( resAddr.resultPosType, "NE", "EV" ) );

View File

@@ -20,6 +20,7 @@
#include "RiaEclipseUnitTools.h"
#include "RigFemAddressDefines.h"
#include "RigFemPart.h"
#include "RigFemPartCollection.h"
#include "RigFemPartResultsCollection.h"
@@ -67,7 +68,7 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorPorosityPermeability::calcul
stepCountProgress.setNextProgressIncrement( m_resultCollection->timeStepCount() );
RigFemScalarResultFrames* srcPorePressureDataFrames =
m_resultCollection->findOrLoadScalarResult( partIndex, RigFemResultAddress( RIG_NODAL, "POR-Bar", "" ) );
m_resultCollection->findOrLoadScalarResult( partIndex, RigFemAddressDefines::nodalPorBarAddress() );
stepCountProgress.incrementProgress();
// Volumetric Strain

View File

@@ -18,6 +18,7 @@
#include "RigFemPartResultCalculatorShearSlipIndicator.h"
#include "RigFemAddressDefines.h"
#include "RigFemPart.h"
#include "RigFemPartCollection.h"
#include "RigFemPartGrid.h"
@@ -66,7 +67,8 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorShearSlipIndicator::calculat
// Pore pressure
stepCountProgress.setNextProgressIncrement( m_resultCollection->timeStepCount() );
RigFemScalarResultFrames* porePressureDataFrames =
m_resultCollection->findOrLoadScalarResult( partIndex, RigFemResultAddress( resVarAddr.resultPosType, "POR-Bar", "" ) );
m_resultCollection->findOrLoadScalarResult( partIndex,
RigFemResultAddress( resVarAddr.resultPosType, RigFemAddressDefines::porBar(), "" ) );
stepCountProgress.incrementProgress();
// Total vertical stress (ST.S33)

View File

@@ -18,6 +18,7 @@
#include "RigFemPartResultCalculatorTimeLapse.h"
#include "RigFemAddressDefines.h"
#include "RigFemPart.h"
#include "RigFemPartCollection.h"
#include "RigFemPartResultCalculatorGamma.h"
@@ -178,7 +179,10 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorTimeLapse::calculateGammaTim
stepCountProgress.setNextProgressIncrement( m_resultCollection->timeStepCount() );
RigFemScalarResultFrames* srcPORDataFrames =
m_resultCollection->findOrLoadScalarResult( partIndex,
RigFemResultAddress( RIG_NODAL, "POR-Bar", "", resVarAddr.timeLapseBaseStepIdx ) );
RigFemResultAddress( RIG_NODAL,
RigFemAddressDefines::porBar(),
"",
resVarAddr.timeLapseBaseStepIdx ) );
RigFemScalarResultFrames* dstDataFrames = m_resultCollection->createScalarResult( partIndex, resVarAddr );
stepCountProgress.incrementProgress();

View File

@@ -26,6 +26,7 @@
#include "RifElementPropertyReader.h"
#include "RifGeoMechReaderInterface.h"
#include "RigFemAddressDefines.h"
#include "RigFemNativeStatCalc.h"
#include "RigFemPartCollection.h"
#include "RigFemPartResultCalculatorBarConverted.h"
@@ -163,8 +164,8 @@ RigFemPartResultsCollection::RigFemPartResultsCollection( RifGeoMechReaderInterf
m_resultCalculators.push_back( std::unique_ptr<RigFemPartResultCalculator>( new RigFemPartResultCalculatorSurfaceAlignedStress( *this ) ) );
m_resultCalculators.push_back(
std::unique_ptr<RigFemPartResultCalculator>( new RigFemPartResultCalculatorBarConverted( *this, "S-Bar", "S" ) ) );
m_resultCalculators.push_back(
std::unique_ptr<RigFemPartResultCalculator>( new RigFemPartResultCalculatorBarConverted( *this, "POR-Bar", "POR" ) ) );
m_resultCalculators.push_back( std::unique_ptr<RigFemPartResultCalculator>(
new RigFemPartResultCalculatorBarConverted( *this, RigFemAddressDefines::porBar(), "POR" ) ) );
m_resultCalculators.push_back( std::unique_ptr<RigFemPartResultCalculator>( new RigFemPartResultCalculatorEnIpPorBar( *this ) ) );
m_resultCalculators.push_back( std::unique_ptr<RigFemPartResultCalculator>( new RigFemPartResultCalculatorNodalGradients( *this ) ) );
m_resultCalculators.push_back( std::unique_ptr<RigFemPartResultCalculator>( new RigFemPartResultCalculatorCompaction( *this ) ) );
@@ -573,7 +574,7 @@ std::map<std::string, std::vector<std::string>> RigFemPartResultsCollection::sca
{
fieldCompNames = m_readerInterface->scalarNodeFieldAndComponentNames();
if ( fieldCompNames.contains( "U" ) ) fieldCompNames["U"].push_back( "U_LENGTH" );
fieldCompNames["POR-Bar"];
fieldCompNames[RigFemAddressDefines::porBar()];
fieldCompNames[FIELD_NAME_COMPACTION];
}
else if ( resPos == RIG_ELEMENT_NODAL )
@@ -823,10 +824,10 @@ std::map<std::string, std::vector<std::string>> RigFemPartResultsCollection::sca
}
else if ( resPos == RIG_DIFFERENTIALS )
{
fieldCompNames["POR-Bar"];
fieldCompNames["POR-Bar"].push_back( "X" );
fieldCompNames["POR-Bar"].push_back( "Y" );
fieldCompNames["POR-Bar"].push_back( "Z" );
fieldCompNames[RigFemAddressDefines::porBar()];
fieldCompNames[RigFemAddressDefines::porBar()].push_back( "X" );
fieldCompNames[RigFemAddressDefines::porBar()].push_back( "Y" );
fieldCompNames[RigFemAddressDefines::porBar()].push_back( "Z" );
for ( auto& s : stressGradientComponentNames )
{
@@ -1367,8 +1368,9 @@ std::set<RigFemResultAddress> RigFemPartResultsCollection::normalizedResults()
}
results.insert( RigFemResultAddress( RIG_ELEMENT_NODAL, "ST", "Q", RigFemResultAddress::allTimeLapsesValue(), -1, true ) );
results.insert( RigFemResultAddress( RIG_NODAL, "POR-Bar", "", RigFemResultAddress::allTimeLapsesValue(), -1, true ) );
results.insert( RigFemResultAddress( RIG_ELEMENT_NODAL, "POR-Bar", "", RigFemResultAddress::allTimeLapsesValue(), -1, true ) );
results.insert( RigFemResultAddress( RIG_NODAL, RigFemAddressDefines::porBar(), "", RigFemResultAddress::allTimeLapsesValue(), -1, true ) );
results.insert(
RigFemResultAddress( RIG_ELEMENT_NODAL, RigFemAddressDefines::porBar(), "", RigFemResultAddress::allTimeLapsesValue(), -1, true ) );
return results;
}

View File

@@ -20,6 +20,7 @@
#include "RivFemElmVisibilityCalculator.h"
#include "RigCaseToCaseCellMapper.h"
#include "RigFemAddressDefines.h"
#include "RigFemPart.h"
#include "RigFemPartGrid.h"
#include "RigFemPartResultsCollection.h"
@@ -118,11 +119,7 @@ void RivFemElmVisibilityCalculator::computePropertyVisibility( cvf::UByteArray*
RigGeoMechCaseData* caseData = propFilterColl->reservoirView()->geoMechCase()->geoMechData();
RigFemResultAddress resVarAddress = propertyFilter->resultDefinition->resultAddress();
// Do a "Hack" to use elm nodal and not nodal POR results
if ( resVarAddress.resultPosType == RIG_NODAL && resVarAddress.fieldName == "POR-Bar" )
resVarAddress.resultPosType = RIG_ELEMENT_NODAL;
RigFemResultAddress resVarAddress = RigFemAddressDefines::getResultLookupAddress( propertyFilter->resultDefinition->resultAddress() );
const std::vector<float>& resVals =
caseData->femPartResults()->resultValues( resVarAddress, part->elementPartId(), timeStepIndex, frameIndex );

View File

@@ -17,16 +17,13 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include <cstdlib>
#include "RivFemPartPartMgr.h"
#include "RivGeoMechPartMgr.h"
#include "RiaPreferences.h"
#include "RifGeoMechReaderInterface.h"
#include "RigFemAddressDefines.h"
#include "RigFemPart.h"
#include "RigFemPartResultsCollection.h"
#include "RigFemScalarResultFrames.h"
@@ -38,6 +35,7 @@
#include "RimRegularLegendConfig.h"
#include "RivFemPickSourceInfo.h"
#include "RivGeoMechPartMgr.h"
#include "RivMeshLinesSourceInfo.h"
#include "RivPartPriority.h"
#include "RivResultToTextureMapper.h"
@@ -61,6 +59,8 @@
#include "cvfTransform.h"
#include "cvfUniform.h"
#include <cstdlib>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -286,13 +286,7 @@ void RivFemPartPartMgr::updateCellResultColor( int timeStepIndex, int frameIndex
if ( !caseData ) return;
RigFemResultAddress resVarAddress = cellResultColors->resultAddress();
// Do a "Hack" to show elm nodal and not nodal POR results
if ( resVarAddress.resultPosType == RIG_NODAL && resVarAddress.fieldName == "POR-Bar" )
{
resVarAddress.resultPosType = RIG_ELEMENT_NODAL;
}
RigFemResultAddress resVarAddress = RigFemAddressDefines::getResultLookupAddress( cellResultColors->resultAddress() );
const std::vector<float>& resultValues =
caseData->femPartResults()->resultValues( resVarAddress, m_partIdx, timeStepIndex, frameIndex );

View File

@@ -32,6 +32,7 @@
#include "RimRegularLegendConfig.h"
#include "RimTernaryLegendConfig.h"
#include "RigFemAddressDefines.h"
#include "RigFemPartCollection.h"
#include "RigFemPartResultsCollection.h"
#include "RigFemResultAddress.h"
@@ -223,12 +224,8 @@ void RivIntersectionResultsColoringTools::updateGeoMechCellResultColors( const R
cvf::Part* intersectionFacesPart,
cvf::Vec2fArray* intersectionFacesTextureCoords )
{
RigGeoMechCaseData* caseData = nullptr;
RigFemResultAddress resVarAddress;
{
caseData = geomResultDef->ownerCaseData();
resVarAddress = geomResultDef->resultAddress();
}
RigGeoMechCaseData* caseData = geomResultDef->ownerCaseData();
RigFemResultAddress resVarAddress = RigFemAddressDefines::getResultLookupAddress( geomResultDef->resultAddress() );
if ( !caseData ) return;
@@ -291,12 +288,6 @@ void RivIntersectionResultsColoringTools::updateGeoMechCellResultColors( const R
}
else
{
// Do a "Hack" to show elm nodal and not nodal POR results
if ( resVarAddress.resultPosType == RIG_NODAL && resVarAddress.fieldName == "POR-Bar" )
{
resVarAddress.resultPosType = RIG_ELEMENT_NODAL;
}
bool isElementNodalResult = !( resVarAddress.resultPosType == RIG_NODAL );
if ( caseData->femPartResults()->partCount() == 1 )

View File

@@ -26,6 +26,7 @@
#include "RicfCommandObject.h"
#include "RifOdbReader.h"
#include "RigFemAddressDefines.h"
#include "RigFemPart.h"
#include "RigFemPartCollection.h"
#include "RigFemPartGrid.h"
@@ -503,8 +504,8 @@ cvf::BoundingBox RimGeoMechCase::reservoirBoundingBox()
RigFemPart* femPart = rigCaseData->femParts()->part( p );
const RigFemPartGrid* femPartGrid = femPart->getOrCreateStructGrid();
RigFemResultAddress porBarAddr( RigFemResultPosEnum::RIG_ELEMENT_NODAL, "POR-Bar", "" );
const std::vector<float>& resultValues = rigCaseData->femPartResults()->resultValues( porBarAddr, p, 0, 0 );
const std::vector<float>& resultValues =
rigCaseData->femPartResults()->resultValues( RigFemAddressDefines::elementNodalPorBarAddress(), p, 0, 0 );
for ( int i = 0; i < femPart->elementCount(); ++i )
{

View File

@@ -23,6 +23,7 @@
#include "RiaWeightedMeanCalculator.h"
#include "RigCellGeometryTools.h"
#include "RigFemAddressDefines.h"
#include "RigFemPart.h"
#include "RigFemPartCollection.h"
#include "RigFemPartGrid.h"
@@ -173,7 +174,7 @@ cvf::ref<cvf::UByteArray> RimGeoMechContourMapProjection::getCellVisibility() co
cvf::BoundingBox RimGeoMechContourMapProjection::calculateExpandedPorBarBBox( int timeStep, int frameIndex ) const
{
RigFemResultAddress porBarAddr( RigFemResultPosEnum::RIG_ELEMENT_NODAL,
"POR-Bar",
RigFemAddressDefines::porBar(),
view()->cellResult()->resultComponentName().toStdString() );
RigGeoMechCaseData* caseData = geoMechCase()->geoMechData();
RigFemPartResultsCollection* resultCollection = caseData->femPartResults();
@@ -274,7 +275,7 @@ std::vector<bool> RimGeoMechContourMapProjection::getMapCellVisibility()
if ( m_limitToPorePressureRegions )
{
resAddr = RigFemResultAddress( RigFemResultPosEnum::RIG_ELEMENT_NODAL, "POR-Bar", "" );
resAddr = RigFemAddressDefines::elementNodalPorBarAddress();
}
std::vector<double> cellResults = generateResultsFromAddress( resAddr, mapCellVisibility, view()->currentTimeStep() );
@@ -361,14 +362,14 @@ std::vector<double> RimGeoMechContourMapProjection::generateResultsFromAddress(
if ( !resultAddress.isValid() )
{
wasInvalid = true;
resultAddress = RigFemResultAddress( RigFemResultPosEnum::RIG_ELEMENT_NODAL, "POR-Bar", "" );
resultAddress = RigFemAddressDefines::elementNodalPorBarAddress();
}
if ( resultAddress.fieldName == "PP" )
{
resultAddress.fieldName = "POR-Bar"; // More likely to be in memory than POR
resultAddress.fieldName = RigFemAddressDefines::porBar(); // More likely to be in memory than POR
}
if ( resultAddress.fieldName == "POR-Bar" )
if ( resultAddress.fieldName == RigFemAddressDefines::porBar() )
{
resultAddress.resultPosType = RIG_ELEMENT_NODAL;
}

View File

@@ -25,6 +25,7 @@
#include "RifGeoMechReaderInterface.h"
#include "RigFemAddressDefines.h"
#include "RigFemPartCollection.h"
#include "RigFemPartGrid.h"
#include "RigFemPartResultCalculatorStressAnisotropy.h"
@@ -570,7 +571,7 @@ void RimGeoMechResultDefinition::loadResult()
resultAddress().fieldName == RiaResultNames::wbsSFGResult().toStdString() )
{
RigFemResultAddress stressResAddr( RIG_ELEMENT_NODAL, std::string( "ST" ), "" );
RigFemResultAddress porBarResAddr( RIG_ELEMENT_NODAL, std::string( "POR-Bar" ), "" );
RigFemResultAddress porBarResAddr = RigFemAddressDefines::elementNodalPorBarAddress();
m_geomCase->geoMechData()->femPartResults()->assertResultsLoaded( stressResAddr );
m_geomCase->geoMechData()->femPartResults()->assertResultsLoaded( porBarResAddr );
}
@@ -598,7 +599,7 @@ RigFemResultAddress RimGeoMechResultDefinition::resultAddress() const
if ( resultPositionType() == RIG_DIFFERENTIALS )
{
RigFemResultPosEnum resultPositionType = RIG_ELEMENT_NODAL;
if ( resultFieldName().toStdString() == "POR-Bar" )
if ( resultFieldName().toStdString() == RigFemAddressDefines::porBar() )
{
resultPositionType = RIG_NODAL;
}
@@ -796,7 +797,8 @@ QString RimGeoMechResultDefinition::currentResultUnits() const
return RiaWellLogUnitTools<double>::noUnitString();
}
if ( resultFieldName() == "SE" || resultFieldName() == "ST" || resultFieldName() == "POR-Bar" || resultFieldName() == "SM" ||
if ( resultFieldName() == "SE" || resultFieldName() == "ST" ||
resultFieldName() == QString::fromStdString( RigFemAddressDefines::porBar() ) || resultFieldName() == "SM" ||
resultFieldName() == "SEM" || resultFieldName() == "Q" )
{
auto componentName = resultComponentName();
@@ -805,6 +807,11 @@ QString RimGeoMechResultDefinition::currentResultUnits() const
return "Deg";
}
if ( rigFemResultAddress.normalizeByHydrostaticPressure() )
{
return "sg";
}
return "Bar";
}
else if ( resultFieldName() == "MODULUS" )
@@ -875,7 +882,7 @@ QString RimGeoMechResultDefinition::convertToUiResultFieldName( QString resultFi
if ( resultFieldName == "E" ) newName = "NativeAbaqus Strain";
if ( resultFieldName == "S" ) newName = "NativeAbaqus Stress";
if ( resultFieldName == "NE" ) newName = "E"; // Make NE and NS appear as E and SE
if ( resultFieldName == "POR-Bar" ) newName = "POR"; // POR-Bar appear as POR
if ( resultFieldName == QString::fromStdString( RigFemAddressDefines::porBar() ) ) newName = "POR"; // POR-Bar appear as POR
if ( resultFieldName == "MODULUS" ) newName = "Young's Modulus";
if ( resultFieldName == "RATIO" ) newName = "Poisson's Ratio";
if ( resultFieldName == "UCS" ) newName = "UCS bar/ 100";

View File

@@ -21,6 +21,7 @@
#include "RiaApplication.h"
#include "RiaPreferencesGeoMech.h"
#include "RigFemAddressDefines.h"
#include "RigWellPath.h"
#include "RigWellPathGeometryTools.h"
@@ -476,7 +477,12 @@ bool RimWellIASettings::updateResInsightParameters()
}
}
double ppValue = dataAccess.interpolatedResultValue( "POR-Bar", "", RigFemResultPosEnum::RIG_NODAL, position, 0, 0 );
double ppValue = dataAccess.interpolatedResultValue( QString::fromStdString( RigFemAddressDefines::porBar() ),
"",
RigFemResultPosEnum::RIG_NODAL,
position,
0,
0 );
if ( std::isfinite( ppValue ) )
{
initialStress->addParameter( "PP", ppValue * 100000.0 );

View File

@@ -26,6 +26,7 @@
#include "RiaLogging.h"
#include "RiaResultNames.h"
#include "RiaWeightedMeanCalculator.h"
#include "RiaWellLogUnitTools.h"
#include "RigFemPart.h"
#include "RigFemPartCollection.h"
@@ -34,7 +35,7 @@
#include "RigGeoMechBoreHoleStressCalculator.h"
#include "RigGeoMechCaseData.h"
#include "RiaWellLogUnitTools.h"
#include "RigFemAddressDefines.h"
#include "RigWellLogExtractionTools.h"
#include "RigWellPath.h"
#include "RigWellPathGeometryTools.h"
@@ -93,7 +94,7 @@ void RigGeoMechWellLogExtractor::performCurveDataSmoothing( int
RigFemPartResultsCollection* resultCollection = m_caseData->femPartResults();
RigFemResultAddress shAddr( RIG_ELEMENT_NODAL, "ST", "S3" );
RigFemResultAddress porBarResAddr( RIG_ELEMENT_NODAL, "POR-Bar", "" );
RigFemResultAddress porBarResAddr = RigFemAddressDefines::elementNodalPorBarAddress();
const std::vector<float>& unscaledShValues = resultCollection->resultValues( shAddr, m_partId, timeStepIndex, frameIndex );
const std::vector<float>& porePressures = resultCollection->resultValues( porBarResAddr, m_partId, timeStepIndex, frameIndex );
@@ -206,12 +207,7 @@ QString RigGeoMechWellLogExtractor::curveData( const RigFemResultAddress& resAdd
}
else if ( resAddr.isValid() )
{
RigFemResultAddress convResAddr = resAddr;
// When showing POR results, always use the element nodal result,
// to get correct handling of elements without POR results
if ( convResAddr.fieldName == "POR-Bar" ) convResAddr.resultPosType = RIG_ELEMENT_NODAL;
RigFemResultAddress convResAddr = RigFemAddressDefines::getResultLookupAddress( resAddr );
CVF_ASSERT( resAddr.resultPosType != RIG_WELLPATH_DERIVED );
@@ -591,7 +587,7 @@ void RigGeoMechWellLogExtractor::wellBoreWallCurveData( const RigFemResultAddres
// The result addresses needed
RigFemResultAddress stressResAddr( RIG_ELEMENT_NODAL, "ST", "" );
RigFemResultAddress porBarResAddr( RIG_ELEMENT_NODAL, "POR-Bar", "" );
RigFemResultAddress porBarResAddr = RigFemAddressDefines::elementNodalPorBarAddress();
RigFemPartResultsCollection* resultCollection = m_caseData->femPartResults();

View File

@@ -18,6 +18,7 @@
#include "RigWbsParameter.h"
#include "RiaWellLogUnitTools.h"
#include "RigFemAddressDefines.h"
#include "cafAssert.h"
@@ -234,12 +235,13 @@ bool RigWbsParameter::operator<( const RigWbsParameter& rhs ) const
//--------------------------------------------------------------------------------------------------
RigWbsParameter RigWbsParameter::PP_Reservoir()
{
SourceVector sources = { { GRID, SourceAddress( "POR-Bar", "", RiaWellLogUnitTools<double>::barUnitString() ) },
{ LAS_FILE, SourceAddress( "PP_INP", "", RiaWellLogUnitTools<double>::sg_emwUnitString() ) },
{ LAS_FILE, SourceAddress( "PP_RES_INP", "", RiaWellLogUnitTools<double>::sg_emwUnitString() ) },
{ LAS_FILE, SourceAddress( "POR_RES_INP", "", RiaWellLogUnitTools<double>::gPerCm3UnitString() ) },
{ ELEMENT_PROPERTY_TABLE, SourceAddress( "POR_INP", "", RiaWellLogUnitTools<double>::pascalUnitString() ) },
{ ELEMENT_PROPERTY_TABLE, SourceAddress( "PP_INP", "", RiaWellLogUnitTools<double>::sg_emwUnitString() ) } };
SourceVector sources =
{ { GRID, SourceAddress( QString::fromStdString( RigFemAddressDefines::porBar() ), "", RiaWellLogUnitTools<double>::barUnitString() ) },
{ LAS_FILE, SourceAddress( "PP_INP", "", RiaWellLogUnitTools<double>::sg_emwUnitString() ) },
{ LAS_FILE, SourceAddress( "PP_RES_INP", "", RiaWellLogUnitTools<double>::sg_emwUnitString() ) },
{ LAS_FILE, SourceAddress( "POR_RES_INP", "", RiaWellLogUnitTools<double>::gPerCm3UnitString() ) },
{ ELEMENT_PROPERTY_TABLE, SourceAddress( "POR_INP", "", RiaWellLogUnitTools<double>::pascalUnitString() ) },
{ ELEMENT_PROPERTY_TABLE, SourceAddress( "PP_INP", "", RiaWellLogUnitTools<double>::sg_emwUnitString() ) } };
return RigWbsParameter( "PP_Reservoir", true, sources );
}

View File

@@ -19,6 +19,7 @@
#include "RiuFemResultTextBuilder.h"
#include "RigFemAddressDefines.h"
#include "RigFemClosestResultIndexCalculator.h"
#include "RigFemPart.h"
#include "RigFemPartCollection.h"
@@ -289,8 +290,9 @@ void RiuFemResultTextBuilder::appendTextFromResultColors( RigGeoMechCaseData*
{
float scalarValue = std::numeric_limits<float>::infinity();
int nodeIdx = elementConn[lNodeIdx];
if ( resultDefinition->resultPositionType() == RIG_NODAL || ( resultDefinition->resultPositionType() == RIG_DIFFERENTIALS &&
resultDefinition->resultFieldName() == "POR-Bar" ) )
if ( resultDefinition->resultPositionType() == RIG_NODAL ||
( resultDefinition->resultPositionType() == RIG_DIFFERENTIALS &&
resultDefinition->resultFieldName() == QString::fromStdString( RigFemAddressDefines::porBar() ) ) )
{
scalarValue = scalarResults[nodeIdx];
}