mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
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:
@@ -43,23 +43,21 @@ bool RigCaseCellResultCalculator::computeDifference( RigEclipseCaseData*
|
||||
const RigEclipseResultAddress& address )
|
||||
{
|
||||
CVF_ASSERT( address.isValid() );
|
||||
CVF_ASSERT( address.hasDifferenceCase() || address.isTimeLapse() );
|
||||
CVF_ASSERT( address.isDeltaCaseActive() || address.isDeltaTimeStepActive() );
|
||||
|
||||
// Assume at this stage that data for the case is available
|
||||
// It is up to the caller to make sure the case is read from file
|
||||
|
||||
RigEclipseCaseData* baseCase = sourceCase;
|
||||
|
||||
if ( address.hasDifferenceCase() )
|
||||
if ( address.isDeltaCaseActive() )
|
||||
{
|
||||
auto eclipseCases = RimProject::current()->eclipseCases();
|
||||
for ( RimEclipseCase* c : eclipseCases )
|
||||
{
|
||||
auto eclipseCases = RimProject::current()->eclipseCases();
|
||||
for ( RimEclipseCase* c : eclipseCases )
|
||||
if ( c && c->caseId() == address.deltaCaseId() && c->eclipseCaseData() )
|
||||
{
|
||||
if ( c && c->caseId() == address.m_differenceCaseId && c->eclipseCaseData() )
|
||||
{
|
||||
baseCase = c->eclipseCaseData();
|
||||
}
|
||||
baseCase = c->eclipseCaseData();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,8 +90,8 @@ bool RigCaseCellResultCalculator::computeDifference( RigEclipseCaseData*
|
||||
}
|
||||
|
||||
RigEclipseResultAddress nativeAddress( address );
|
||||
nativeAddress.m_differenceCaseId = RigEclipseResultAddress::noCaseDiffValue();
|
||||
nativeAddress.m_timeLapseBaseFrameIdx = RigEclipseResultAddress::noTimeLapseValue();
|
||||
nativeAddress.setDeltaCaseId( RigEclipseResultAddress::noCaseDiffValue() );
|
||||
nativeAddress.setDeltaTimeStepIndex( RigEclipseResultAddress::noTimeLapseValue() );
|
||||
if ( !sourceCaseResults->ensureKnownResultLoaded( nativeAddress ) )
|
||||
{
|
||||
RiaLogging::error( "Failed to load destination diff result" );
|
||||
@@ -128,7 +126,7 @@ bool RigCaseCellResultCalculator::computeDifference( RigEclipseCaseData*
|
||||
size_t baseFrameCount = baseCaseResults->cellScalarResults( nativeAddress ).size();
|
||||
size_t sourceFrameCount = sourceCaseResults->cellScalarResults( nativeAddress ).size();
|
||||
size_t maxFrameCount = 0;
|
||||
if ( address.isTimeLapse() )
|
||||
if ( address.isDeltaTimeStepActive() )
|
||||
{
|
||||
// We have one defined time step for base case, loop over all source time steps
|
||||
maxFrameCount = sourceFrameCount;
|
||||
@@ -155,9 +153,9 @@ bool RigCaseCellResultCalculator::computeDifference( RigEclipseCaseData*
|
||||
RigResultModifierFactory::createResultModifier( sourceCase, gridIdx, porosityModel, fIdx, address );
|
||||
|
||||
size_t baseFrameIdx = fIdx;
|
||||
if ( address.isTimeLapse() )
|
||||
if ( address.isDeltaTimeStepActive() )
|
||||
{
|
||||
baseFrameIdx = address.m_timeLapseBaseFrameIdx;
|
||||
baseFrameIdx = address.deltaTimeStepIndex();
|
||||
}
|
||||
|
||||
cvf::ref<RigResultAccessor> baseResultAccessor =
|
||||
@@ -181,3 +179,113 @@ bool RigCaseCellResultCalculator::computeDifference( RigEclipseCaseData*
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigCaseCellResultCalculator::computeDivideByCellFaceArea( RigMainGrid* mainGrid,
|
||||
RigEclipseCaseData* destination,
|
||||
RiaDefines::PorosityModelType porosityModel,
|
||||
const RigEclipseResultAddress& address )
|
||||
{
|
||||
if ( !destination )
|
||||
{
|
||||
RiaLogging::error( "Missing input case for divide by area calculator" );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
CVF_ASSERT( address.isValid() );
|
||||
CVF_ASSERT( address.isDivideByCellFaceAreaActive() );
|
||||
|
||||
RigCaseCellResultsData* baseCaseResults = destination->results( porosityModel );
|
||||
if ( !baseCaseResults )
|
||||
{
|
||||
RiaLogging::error( "Missing result data for divide by area calculator" );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
RigEclipseResultAddress nativeAddress( address );
|
||||
nativeAddress.enableDivideByCellFaceArea( false );
|
||||
if ( !baseCaseResults->ensureKnownResultLoaded( nativeAddress ) )
|
||||
{
|
||||
RiaLogging::error( "Failed to load source case for divide by area result" );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Initialize difference result with infinity for correct number of time steps and values per time step
|
||||
{
|
||||
const std::vector<std::vector<double>>& srcFrames = baseCaseResults->cellScalarResults( nativeAddress );
|
||||
std::vector<std::vector<double>>* diffResultFrames =
|
||||
baseCaseResults->modifiableCellScalarResultTimesteps( address );
|
||||
diffResultFrames->resize( srcFrames.size() );
|
||||
for ( size_t fIdx = 0; fIdx < srcFrames.size(); ++fIdx )
|
||||
{
|
||||
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 maxGridCount = mainGrid->gridCount();
|
||||
|
||||
cvf::StructGridInterface::FaceType cellFace = cvf::StructGridInterface::NO_FACE;
|
||||
QString resultName = address.resultName();
|
||||
if ( resultName.contains( "I+" ) )
|
||||
cellFace = cvf::StructGridInterface::POS_I;
|
||||
else if ( resultName.contains( "J+" ) )
|
||||
cellFace = cvf::StructGridInterface::POS_J;
|
||||
else if ( resultName.contains( "K+" ) )
|
||||
cellFace = cvf::StructGridInterface::POS_K;
|
||||
else if ( resultName.contains( "TRANX" ) )
|
||||
cellFace = cvf::StructGridInterface::POS_I;
|
||||
else if ( resultName.contains( "TRANY" ) )
|
||||
cellFace = cvf::StructGridInterface::POS_J;
|
||||
else if ( resultName.contains( "TRANZ" ) )
|
||||
cellFace = cvf::StructGridInterface::POS_K;
|
||||
|
||||
for ( size_t gridIdx = 0; gridIdx < maxGridCount; ++gridIdx )
|
||||
{
|
||||
auto grid = mainGrid->gridByIndex( gridIdx );
|
||||
const RigActiveCellInfo* activeCellInfo = baseCaseResults->activeCellInfo();
|
||||
|
||||
for ( size_t fIdx = 0; fIdx < baseFrameCount; ++fIdx )
|
||||
{
|
||||
cvf::ref<RigResultAccessor> sourceResultAccessor =
|
||||
RigResultAccessorFactory::createFromResultAddress( destination, gridIdx, porosityModel, fIdx, nativeAddress );
|
||||
|
||||
cvf::ref<RigResultModifier> resultModifier =
|
||||
RigResultModifierFactory::createResultModifier( destination, gridIdx, porosityModel, fIdx, address );
|
||||
|
||||
#pragma omp parallel for
|
||||
for ( int localGridCellIdx = 0; localGridCellIdx < static_cast<int>( grid->cellCount() ); localGridCellIdx++ )
|
||||
{
|
||||
const size_t reservoirCellIndex = grid->reservoirCellIndex( localGridCellIdx );
|
||||
if ( activeCellInfo->isActive( reservoirCellIndex ) )
|
||||
{
|
||||
double sourceVal = sourceResultAccessor->cellScalar( localGridCellIdx );
|
||||
|
||||
const auto faceNormal = grid->cell( localGridCellIdx ).faceNormalWithAreaLength( cellFace );
|
||||
const auto divisor = faceNormal.length();
|
||||
|
||||
const double epsilon = 1e-12;
|
||||
if ( divisor > epsilon )
|
||||
{
|
||||
sourceVal /= divisor;
|
||||
}
|
||||
|
||||
resultModifier->setCellScalar( localGridCellIdx, sourceVal );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
class RigEclipseCaseData;
|
||||
class RigEclipseResultAddress;
|
||||
class RigMainGrid;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -32,4 +33,9 @@ public:
|
||||
static bool computeDifference( RigEclipseCaseData* destination,
|
||||
RiaDefines::PorosityModelType porosityModel,
|
||||
const RigEclipseResultAddress& address );
|
||||
|
||||
static bool computeDivideByCellFaceArea( RigMainGrid* mainGrid,
|
||||
RigEclipseCaseData* destination,
|
||||
RiaDefines::PorosityModelType porosityModel,
|
||||
const RigEclipseResultAddress& address );
|
||||
};
|
||||
|
||||
@@ -320,7 +320,7 @@ size_t RigCaseCellResultsData::findOrCreateScalarResultIndex( const RigEclipseRe
|
||||
// Create statistics calculator and add statistics cache object
|
||||
// Todo: Move to a "factory" method
|
||||
|
||||
QString resultName = resVarAddr.m_resultName;
|
||||
QString resultName = resVarAddr.resultName();
|
||||
|
||||
cvf::ref<RigStatisticsCalculator> statisticsCalculator;
|
||||
|
||||
@@ -483,8 +483,12 @@ QStringList RigCaseCellResultsData::resultNames( RiaDefines::ResultCatType resTy
|
||||
std::vector<RigEclipseResultInfo>::const_iterator it;
|
||||
for ( it = m_resultInfos.begin(); it != m_resultInfos.end(); ++it )
|
||||
{
|
||||
if ( it->resultType() == resType && !it->eclipseResultAddress().isTimeLapse() &&
|
||||
!it->eclipseResultAddress().hasDifferenceCase() )
|
||||
auto resultAddress = it->eclipseResultAddress();
|
||||
if ( resultAddress.isDeltaTimeStepActive() || resultAddress.isDeltaCaseActive() ||
|
||||
resultAddress.isDivideByCellFaceAreaActive() )
|
||||
continue;
|
||||
|
||||
if ( it->resultType() == resType )
|
||||
{
|
||||
varList.push_back( it->resultName() );
|
||||
}
|
||||
@@ -1045,7 +1049,7 @@ void RigCaseCellResultsData::createPlaceholderResultEntries()
|
||||
}
|
||||
}
|
||||
|
||||
// riTRANSXYZbyArea and X, Y, Z
|
||||
// riTRANS X,Y,Z byArea
|
||||
{
|
||||
if ( hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "TRANX" ) ) )
|
||||
{
|
||||
@@ -1070,7 +1074,9 @@ void RigCaseCellResultsData::createPlaceholderResultEntries()
|
||||
false,
|
||||
0 );
|
||||
}
|
||||
|
||||
}
|
||||
// riTRANSXYZbyArea
|
||||
{
|
||||
if ( hasCompleteTransmissibilityResults() )
|
||||
{
|
||||
addStaticScalarResult( RiaDefines::ResultCatType::STATIC_NATIVE,
|
||||
@@ -1184,7 +1190,7 @@ void RigCaseCellResultsData::createResultEntry( const RigEclipseResultAddress& r
|
||||
void RigCaseCellResultsData::ensureKnownResultLoadedForTimeStep( const RigEclipseResultAddress& resultAddress,
|
||||
size_t timeStepIndex )
|
||||
{
|
||||
CAF_ASSERT( resultAddress.m_resultCatType != RiaDefines::ResultCatType::UNDEFINED );
|
||||
CAF_ASSERT( resultAddress.resultCatType() != RiaDefines::ResultCatType::UNDEFINED );
|
||||
|
||||
findOrLoadKnownScalarResultForTimeStep( resultAddress, timeStepIndex );
|
||||
}
|
||||
@@ -1198,7 +1204,7 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResult( const RigEclipseResu
|
||||
{
|
||||
return cvf::UNDEFINED_SIZE_T;
|
||||
}
|
||||
else if ( resVarAddr.m_resultCatType == RiaDefines::ResultCatType::UNDEFINED )
|
||||
else if ( resVarAddr.resultCatType() == RiaDefines::ResultCatType::UNDEFINED )
|
||||
{
|
||||
std::vector<RiaDefines::ResultCatType> searchOrder = { RiaDefines::ResultCatType::STATIC_NATIVE,
|
||||
RiaDefines::ResultCatType::DYNAMIC_NATIVE,
|
||||
@@ -1216,10 +1222,10 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResult( const RigEclipseResu
|
||||
|
||||
if ( scalarResultIndex == cvf::UNDEFINED_SIZE_T ) return cvf::UNDEFINED_SIZE_T;
|
||||
|
||||
RiaDefines::ResultCatType type = resVarAddr.m_resultCatType;
|
||||
QString resultName = resVarAddr.m_resultName;
|
||||
RiaDefines::ResultCatType type = resVarAddr.resultCatType();
|
||||
QString resultName = resVarAddr.resultName();
|
||||
|
||||
if ( resVarAddr.hasDifferenceCase() || resVarAddr.isTimeLapse() )
|
||||
if ( resVarAddr.isDeltaCaseActive() || resVarAddr.isDeltaTimeStepActive() )
|
||||
{
|
||||
if ( !RigCaseCellResultCalculator::computeDifference( this->m_ownerCaseData, m_porosityModel, resVarAddr ) )
|
||||
{
|
||||
@@ -1229,6 +1235,20 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResult( const RigEclipseResu
|
||||
return scalarResultIndex;
|
||||
}
|
||||
|
||||
if ( resVarAddr.isDivideByCellFaceAreaActive() )
|
||||
{
|
||||
if ( !RigCaseCellResultCalculator::computeDivideByCellFaceArea( m_ownerMainGrid,
|
||||
this->m_ownerCaseData,
|
||||
m_porosityModel,
|
||||
resVarAddr ) )
|
||||
|
||||
{
|
||||
return cvf::UNDEFINED_SIZE_T;
|
||||
}
|
||||
|
||||
return scalarResultIndex;
|
||||
}
|
||||
|
||||
// Load dependency data sets
|
||||
|
||||
if ( type == RiaDefines::ResultCatType::STATIC_NATIVE )
|
||||
@@ -1500,7 +1520,7 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResultByResultTypeOrder(
|
||||
for ( const auto& resultType : resultTypesOrdered )
|
||||
{
|
||||
RigEclipseResultAddress resVarAddressWithType = resVarAddr;
|
||||
resVarAddressWithType.m_resultCatType = resultType;
|
||||
resVarAddressWithType.setResultCatType( resultType );
|
||||
|
||||
size_t scalarResultIndex = this->findOrLoadKnownScalarResult( resVarAddressWithType );
|
||||
|
||||
@@ -1520,8 +1540,8 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResultByResultTypeOrder(
|
||||
size_t RigCaseCellResultsData::findOrLoadKnownScalarResultForTimeStep( const RigEclipseResultAddress& resVarAddr,
|
||||
size_t timeStepIndex )
|
||||
{
|
||||
RiaDefines::ResultCatType type = resVarAddr.m_resultCatType;
|
||||
QString resultName = resVarAddr.m_resultName;
|
||||
RiaDefines::ResultCatType type = resVarAddr.resultCatType();
|
||||
QString resultName = resVarAddr.resultName();
|
||||
|
||||
// Special handling for SOIL
|
||||
if ( type == RiaDefines::ResultCatType::DYNAMIC_NATIVE && resultName.toUpper() == "SOIL" )
|
||||
@@ -2596,6 +2616,7 @@ void RigCaseCellResultsData::computeRiTRANSbyAreaComponent( const QString& riTra
|
||||
|
||||
size_t riTranByAreaScResIdx = this->findScalarResultIndexFromAddress(
|
||||
RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, riTransByAreaCompResultName ) );
|
||||
|
||||
CVF_ASSERT( riTranByAreaScResIdx != cvf::UNDEFINED_SIZE_T );
|
||||
|
||||
// Get the result count, to handle that one of them might be globally defined
|
||||
@@ -3250,42 +3271,42 @@ size_t RigCaseCellResultsData::findScalarResultIndexFromAddress( const RigEclips
|
||||
{
|
||||
return cvf::UNDEFINED_SIZE_T;
|
||||
}
|
||||
else if ( resVarAddr.m_resultCatType == RiaDefines::ResultCatType::UNDEFINED )
|
||||
else if ( resVarAddr.resultCatType() == RiaDefines::ResultCatType::UNDEFINED )
|
||||
{
|
||||
RigEclipseResultAddress resVarAddressWithType = resVarAddr;
|
||||
|
||||
resVarAddressWithType.m_resultCatType = RiaDefines::ResultCatType::STATIC_NATIVE;
|
||||
resVarAddressWithType.setResultCatType( RiaDefines::ResultCatType::STATIC_NATIVE );
|
||||
|
||||
size_t scalarResultIndex = this->findScalarResultIndexFromAddress( resVarAddressWithType );
|
||||
|
||||
if ( scalarResultIndex == cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
resVarAddressWithType.m_resultCatType = RiaDefines::ResultCatType::DYNAMIC_NATIVE;
|
||||
scalarResultIndex = this->findScalarResultIndexFromAddress( resVarAddressWithType );
|
||||
resVarAddressWithType.setResultCatType( RiaDefines::ResultCatType::DYNAMIC_NATIVE );
|
||||
scalarResultIndex = this->findScalarResultIndexFromAddress( resVarAddressWithType );
|
||||
}
|
||||
|
||||
if ( scalarResultIndex == cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
resVarAddressWithType.m_resultCatType = RiaDefines::ResultCatType::SOURSIMRL;
|
||||
scalarResultIndex = this->findScalarResultIndexFromAddress( resVarAddressWithType );
|
||||
resVarAddressWithType.setResultCatType( RiaDefines::ResultCatType::SOURSIMRL );
|
||||
scalarResultIndex = this->findScalarResultIndexFromAddress( resVarAddressWithType );
|
||||
}
|
||||
|
||||
if ( scalarResultIndex == cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
resVarAddressWithType.m_resultCatType = RiaDefines::ResultCatType::GENERATED;
|
||||
scalarResultIndex = this->findScalarResultIndexFromAddress( resVarAddressWithType );
|
||||
resVarAddressWithType.setResultCatType( RiaDefines::ResultCatType::GENERATED );
|
||||
scalarResultIndex = this->findScalarResultIndexFromAddress( resVarAddressWithType );
|
||||
}
|
||||
|
||||
if ( scalarResultIndex == cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
resVarAddressWithType.m_resultCatType = RiaDefines::ResultCatType::INPUT_PROPERTY;
|
||||
scalarResultIndex = this->findScalarResultIndexFromAddress( resVarAddressWithType );
|
||||
resVarAddressWithType.setResultCatType( RiaDefines::ResultCatType::INPUT_PROPERTY );
|
||||
scalarResultIndex = this->findScalarResultIndexFromAddress( resVarAddressWithType );
|
||||
}
|
||||
|
||||
if ( scalarResultIndex == cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
resVarAddressWithType.m_resultCatType = RiaDefines::ResultCatType::FORMATION_NAMES;
|
||||
scalarResultIndex = this->findScalarResultIndexFromAddress( resVarAddressWithType );
|
||||
resVarAddressWithType.setResultCatType( RiaDefines::ResultCatType::FORMATION_NAMES );
|
||||
scalarResultIndex = this->findScalarResultIndexFromAddress( resVarAddressWithType );
|
||||
}
|
||||
|
||||
return scalarResultIndex;
|
||||
|
||||
@@ -29,6 +29,7 @@ public:
|
||||
: m_resultCatType( RiaDefines::ResultCatType::UNDEFINED )
|
||||
, m_timeLapseBaseFrameIdx( NO_TIME_LAPSE )
|
||||
, m_differenceCaseId( NO_CASE_DIFF )
|
||||
, m_divideByCellFaceArea( false )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -37,18 +38,22 @@ public:
|
||||
, m_resultName( resultName )
|
||||
, m_timeLapseBaseFrameIdx( NO_TIME_LAPSE )
|
||||
, m_differenceCaseId( NO_CASE_DIFF )
|
||||
, m_divideByCellFaceArea( false )
|
||||
{
|
||||
}
|
||||
|
||||
explicit RigEclipseResultAddress( RiaDefines::ResultCatType type,
|
||||
const QString& resultName,
|
||||
int timeLapseBaseTimeStep = NO_TIME_LAPSE,
|
||||
int differenceCaseId = NO_CASE_DIFF )
|
||||
int differenceCaseId = NO_CASE_DIFF,
|
||||
bool divideByCellFaceArea = false )
|
||||
: m_resultCatType( type )
|
||||
, m_resultName( resultName )
|
||||
, m_timeLapseBaseFrameIdx( timeLapseBaseTimeStep )
|
||||
, m_differenceCaseId( differenceCaseId )
|
||||
, m_divideByCellFaceArea( false )
|
||||
{
|
||||
enableDivideByCellFaceArea( divideByCellFaceArea );
|
||||
}
|
||||
|
||||
bool isValid() const
|
||||
@@ -63,17 +68,46 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
// Delta Time Step
|
||||
bool isDeltaTimeStepActive() const { return m_timeLapseBaseFrameIdx > NO_TIME_LAPSE; }
|
||||
void setDeltaTimeStepIndex( int timeStepIndex ) { m_timeLapseBaseFrameIdx = timeStepIndex; }
|
||||
int deltaTimeStepIndex() const { return m_timeLapseBaseFrameIdx; }
|
||||
bool representsAllTimeLapses() const { return m_timeLapseBaseFrameIdx == ALL_TIME_LAPSES; }
|
||||
static constexpr int allTimeLapsesValue() { return ALL_TIME_LAPSES; }
|
||||
static constexpr int noTimeLapseValue() { return NO_TIME_LAPSE; }
|
||||
|
||||
// Delta Grid Case
|
||||
bool isDeltaCaseActive() const { return m_differenceCaseId > NO_CASE_DIFF; }
|
||||
void setDeltaCaseId( int caseId ) { m_differenceCaseId = caseId; }
|
||||
int deltaCaseId() const { return m_differenceCaseId; }
|
||||
static constexpr int noCaseDiffValue() { return NO_CASE_DIFF; }
|
||||
|
||||
bool isTimeLapse() const { return m_timeLapseBaseFrameIdx > NO_TIME_LAPSE; }
|
||||
bool representsAllTimeLapses() const { return m_timeLapseBaseFrameIdx == ALL_TIME_LAPSES; }
|
||||
// Divide by Cell Face Area
|
||||
void enableDivideByCellFaceArea( bool enable )
|
||||
{
|
||||
if ( enable )
|
||||
{
|
||||
if ( !m_divideByCellFaceArea )
|
||||
{
|
||||
m_resultName += " /A";
|
||||
}
|
||||
}
|
||||
else if ( m_divideByCellFaceArea )
|
||||
{
|
||||
m_resultName = m_resultName.left( m_resultName.size() - 3 );
|
||||
}
|
||||
m_divideByCellFaceArea = enable;
|
||||
}
|
||||
|
||||
bool hasDifferenceCase() const { return m_differenceCaseId > NO_CASE_DIFF; }
|
||||
bool isDivideByCellFaceAreaActive() const { return m_divideByCellFaceArea; }
|
||||
|
||||
bool operator<( const RigEclipseResultAddress& other ) const
|
||||
{
|
||||
if ( m_divideByCellFaceArea != other.m_divideByCellFaceArea )
|
||||
{
|
||||
return ( m_divideByCellFaceArea < other.m_divideByCellFaceArea );
|
||||
}
|
||||
|
||||
if ( m_differenceCaseId != other.m_differenceCaseId )
|
||||
{
|
||||
return ( m_differenceCaseId < other.m_differenceCaseId );
|
||||
@@ -95,7 +129,8 @@ public:
|
||||
bool operator==( const RigEclipseResultAddress& other ) const
|
||||
{
|
||||
if ( m_resultCatType != other.m_resultCatType || m_resultName != other.m_resultName ||
|
||||
m_timeLapseBaseFrameIdx != other.m_timeLapseBaseFrameIdx || m_differenceCaseId != other.m_differenceCaseId )
|
||||
m_timeLapseBaseFrameIdx != other.m_timeLapseBaseFrameIdx ||
|
||||
m_differenceCaseId != other.m_differenceCaseId || m_divideByCellFaceArea != other.m_divideByCellFaceArea )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -103,13 +138,19 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
const QString& resultName() const { return m_resultName; }
|
||||
void setResultName( QString name ) { m_resultName = name; }
|
||||
|
||||
RiaDefines::ResultCatType resultCatType() const { return m_resultCatType; }
|
||||
void setResultCatType( RiaDefines::ResultCatType catType ) { m_resultCatType = catType; }
|
||||
|
||||
private:
|
||||
int m_timeLapseBaseFrameIdx;
|
||||
int m_differenceCaseId;
|
||||
bool m_divideByCellFaceArea;
|
||||
RiaDefines::ResultCatType m_resultCatType;
|
||||
QString m_resultName;
|
||||
|
||||
int m_timeLapseBaseFrameIdx;
|
||||
int m_differenceCaseId;
|
||||
|
||||
private:
|
||||
static const int ALL_TIME_LAPSES = -2;
|
||||
static const int NO_TIME_LAPSE = -1;
|
||||
static const int NO_CASE_DIFF = -1;
|
||||
|
||||
@@ -70,7 +70,7 @@ RigEclipseResultInfo::RigEclipseResultInfo( const RigEclipseResultAddress& resul
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaDefines::ResultCatType RigEclipseResultInfo::resultType() const
|
||||
{
|
||||
return m_resultAddress.m_resultCatType;
|
||||
return m_resultAddress.resultCatType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -78,7 +78,7 @@ RiaDefines::ResultCatType RigEclipseResultInfo::resultType() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigEclipseResultInfo::setResultType( RiaDefines::ResultCatType newType )
|
||||
{
|
||||
m_resultAddress.m_resultCatType = newType;
|
||||
m_resultAddress.setResultCatType( newType );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -86,7 +86,7 @@ void RigEclipseResultInfo::setResultType( RiaDefines::ResultCatType newType )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const QString& RigEclipseResultInfo::resultName() const
|
||||
{
|
||||
return m_resultAddress.m_resultName;
|
||||
return m_resultAddress.resultName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -94,7 +94,7 @@ const QString& RigEclipseResultInfo::resultName() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigEclipseResultInfo::setResultName( const QString& name )
|
||||
{
|
||||
m_resultAddress.m_resultName = name;
|
||||
m_resultAddress.setResultName( name );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -188,7 +188,7 @@ size_t RigNNCData::connectionsWithNoCommonArea( QStringList& connectionTextFirst
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigNNCData::ensureConnectionDataIsProcecced()
|
||||
bool RigNNCData::ensureConnectionDataIsProcessed()
|
||||
{
|
||||
if ( m_connectionsAreProcessed ) return false;
|
||||
|
||||
@@ -258,7 +258,7 @@ size_t RigNNCData::nativeConnectionCount() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigConnectionContainer& RigNNCData::connections()
|
||||
{
|
||||
ensureConnectionDataIsProcecced();
|
||||
ensureConnectionDataIsProcessed();
|
||||
|
||||
return m_connections;
|
||||
}
|
||||
@@ -268,7 +268,7 @@ RigConnectionContainer& RigNNCData::connections()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double>& RigNNCData::makeStaticConnectionScalarResult( QString nncDataType )
|
||||
{
|
||||
ensureConnectionDataIsProcecced();
|
||||
ensureConnectionDataIsProcessed();
|
||||
|
||||
std::vector<std::vector<double>>& results = m_connectionResults[nncDataType];
|
||||
results.resize( 1 );
|
||||
@@ -566,15 +566,17 @@ std::vector<QString> RigNNCData::availableProperties( NNCResultType resultType )
|
||||
|
||||
for ( auto it : m_connectionResults )
|
||||
{
|
||||
if ( resultType == NNC_STATIC && it.second.size() == 1 && it.second[0].size() > 0 && isNative( it.first ) )
|
||||
if ( resultType == NNCResultType::NNC_STATIC && it.second.size() == 1 && it.second[0].size() > 0 &&
|
||||
isNative( it.first ) )
|
||||
{
|
||||
properties.push_back( it.first );
|
||||
}
|
||||
else if ( resultType == NNC_DYNAMIC && it.second.size() > 1 && it.second[0].size() > 0 && isNative( it.first ) )
|
||||
else if ( resultType == NNCResultType::NNC_DYNAMIC && it.second.size() > 1 && it.second[0].size() > 0 &&
|
||||
isNative( it.first ) )
|
||||
{
|
||||
properties.push_back( it.first );
|
||||
}
|
||||
else if ( resultType == NNC_GENERATED && !isNative( it.first ) )
|
||||
else if ( resultType == NNCResultType::NNC_GENERATED && !isNative( it.first ) )
|
||||
{
|
||||
properties.push_back( it.first );
|
||||
}
|
||||
@@ -603,6 +605,62 @@ bool RigNNCData::hasScalarValues( const RigEclipseResultAddress& resVarAddr )
|
||||
return ( it != m_connectionResults.end() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigNNCData::generateScalarValues( const RigEclipseResultAddress& resVarAddr )
|
||||
{
|
||||
if ( hasScalarValues( resVarAddr ) ) return true;
|
||||
|
||||
if ( resVarAddr.isDivideByCellFaceAreaActive() && resVarAddr.resultCatType() == RiaDefines::ResultCatType::DYNAMIC_NATIVE )
|
||||
{
|
||||
RigEclipseResultAddress tmpAddr = resVarAddr;
|
||||
tmpAddr.enableDivideByCellFaceArea( false );
|
||||
|
||||
auto nameit = m_resultAddrToNNCDataType.find( tmpAddr );
|
||||
if ( nameit == m_resultAddrToNNCDataType.end() ) return false;
|
||||
|
||||
auto it = m_connectionResults.find( nameit->second );
|
||||
if ( it == m_connectionResults.end() ) return false;
|
||||
|
||||
auto& srcdata = it->second;
|
||||
|
||||
auto& dstdata = makeDynamicConnectionScalarResult( resVarAddr.resultName(), srcdata.size() );
|
||||
|
||||
const double epsilon = 1.0e-3;
|
||||
|
||||
std::vector<double> areas( m_connections.size() );
|
||||
|
||||
for ( size_t dataIdx = 0; dataIdx < m_connections.size(); dataIdx++ )
|
||||
{
|
||||
double area = 0.0;
|
||||
if ( m_connections[dataIdx].hasCommonArea() )
|
||||
area = cvf::GeometryTools::polygonArea( m_connections[dataIdx].polygon() );
|
||||
areas[dataIdx] = area;
|
||||
}
|
||||
|
||||
#pragma omp parallel for
|
||||
for ( int i = 0; i < static_cast<int>( srcdata.size() ); i++ )
|
||||
{
|
||||
size_t timeIdx = i;
|
||||
dstdata[timeIdx].resize( srcdata[timeIdx].size() );
|
||||
|
||||
for ( size_t dataIdx = 0; dataIdx < srcdata[timeIdx].size(); dataIdx++ )
|
||||
{
|
||||
double scaledVal = 0.0;
|
||||
if ( areas[dataIdx] > epsilon ) scaledVal = srcdata[timeIdx][dataIdx] / areas[dataIdx];
|
||||
dstdata[timeIdx][dataIdx] = scaledVal;
|
||||
}
|
||||
}
|
||||
|
||||
m_resultAddrToNNCDataType[resVarAddr] = resVarAddr.resultName();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -613,6 +671,7 @@ const QString RigNNCData::getNNCDataTypeFromScalarResultIndex( const RigEclipseR
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ class QStringList;
|
||||
class RigNNCData : public cvf::Object
|
||||
{
|
||||
public:
|
||||
enum NNCResultType
|
||||
enum class NNCResultType
|
||||
{
|
||||
NNC_DYNAMIC,
|
||||
NNC_STATIC,
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
|
||||
RigNNCData();
|
||||
|
||||
bool ensureConnectionDataIsProcecced();
|
||||
bool ensureConnectionDataIsProcessed();
|
||||
void setSourceDataForProcessing( RigMainGrid* mainGrid,
|
||||
const RigActiveCellInfo* activeCellInfo,
|
||||
bool includeInactiveCells );
|
||||
@@ -89,6 +89,8 @@ public:
|
||||
|
||||
bool hasScalarValues( const RigEclipseResultAddress& resVarAddr );
|
||||
|
||||
bool generateScalarValues( const RigEclipseResultAddress& resVarAddr );
|
||||
|
||||
private:
|
||||
const QString getNNCDataTypeFromScalarResultIndex( const RigEclipseResultAddress& resVarAddr ) const;
|
||||
bool isNative( QString nncDataType ) const;
|
||||
|
||||
@@ -95,8 +95,8 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createFromResultAddress( c
|
||||
}
|
||||
|
||||
size_t adjustedTimeStepIndex = timeStepIndex;
|
||||
if ( resVarAddr.m_resultCatType == RiaDefines::ResultCatType::STATIC_NATIVE ||
|
||||
resVarAddr.m_resultCatType == RiaDefines::ResultCatType::FORMATION_NAMES )
|
||||
if ( resVarAddr.resultCatType() == RiaDefines::ResultCatType::STATIC_NATIVE ||
|
||||
resVarAddr.resultCatType() == RiaDefines::ResultCatType::FORMATION_NAMES )
|
||||
{
|
||||
adjustedTimeStepIndex = 0;
|
||||
}
|
||||
@@ -127,26 +127,26 @@ cvf::ref<RigResultAccessor>
|
||||
RigEclipseResultAddress nativeAddr( resVarAddr );
|
||||
const RigGridBase* grid = eclipseCase->grid( gridIndex );
|
||||
|
||||
if ( resVarAddr.m_resultName == RiaResultNames::combinedTransmissibilityResultName() )
|
||||
if ( resVarAddr.resultName() == RiaResultNames::combinedTransmissibilityResultName() )
|
||||
{
|
||||
CVF_ASSERT( timeStepIndex == 0 ); // Static result, only data for first time step
|
||||
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor( grid );
|
||||
nativeAddr.m_resultName = "TRANX";
|
||||
nativeAddr.setResultName( "TRANX" );
|
||||
cvf::ref<RigResultAccessor> xTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = "TRANY";
|
||||
nativeAddr.setResultName( "TRANY" );
|
||||
cvf::ref<RigResultAccessor> yTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = "TRANZ";
|
||||
nativeAddr.setResultName( "TRANZ" );
|
||||
cvf::ref<RigResultAccessor> zTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
@@ -158,43 +158,43 @@ cvf::ref<RigResultAccessor>
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
else if ( resVarAddr.m_resultName == RiaResultNames::combinedMultResultName() )
|
||||
else if ( resVarAddr.resultName() == RiaResultNames::combinedMultResultName() )
|
||||
{
|
||||
CVF_ASSERT( timeStepIndex == 0 ); // Static result, only data for first time step
|
||||
|
||||
cvf::ref<RigCombMultResultAccessor> cellFaceAccessObject = new RigCombMultResultAccessor( grid );
|
||||
|
||||
nativeAddr.m_resultName = "MULTX";
|
||||
nativeAddr.setResultName( "MULTX" );
|
||||
cvf::ref<RigResultAccessor> multXPos = RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = "MULTX-";
|
||||
nativeAddr.setResultName( "MULTX-" );
|
||||
cvf::ref<RigResultAccessor> multXNeg = RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = "MULTY";
|
||||
nativeAddr.setResultName( "MULTY" );
|
||||
cvf::ref<RigResultAccessor> multYPos = RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = "MULTY-";
|
||||
nativeAddr.setResultName( "MULTY-" );
|
||||
cvf::ref<RigResultAccessor> multYNeg = RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = "MULTZ";
|
||||
nativeAddr.setResultName( "MULTZ" );
|
||||
cvf::ref<RigResultAccessor> multZPos = RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = "MULTZ-";
|
||||
nativeAddr.setResultName( "MULTZ-" );
|
||||
cvf::ref<RigResultAccessor> multZNeg = RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
@@ -206,27 +206,27 @@ cvf::ref<RigResultAccessor>
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
else if ( resVarAddr.m_resultName == RiaResultNames::combinedRiTranResultName() )
|
||||
else if ( resVarAddr.resultName() == RiaResultNames::combinedRiTranResultName() )
|
||||
{
|
||||
CVF_ASSERT( timeStepIndex == 0 ); // Static result, only data for first time step
|
||||
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor( grid );
|
||||
|
||||
nativeAddr.m_resultName = RiaResultNames::riTranXResultName();
|
||||
nativeAddr.setResultName( RiaResultNames::riTranXResultName() );
|
||||
cvf::ref<RigResultAccessor> xTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = RiaResultNames::riTranYResultName();
|
||||
nativeAddr.setResultName( RiaResultNames::riTranYResultName() );
|
||||
cvf::ref<RigResultAccessor> yTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = RiaResultNames::riTranZResultName();
|
||||
nativeAddr.setResultName( RiaResultNames::riTranZResultName() );
|
||||
cvf::ref<RigResultAccessor> zTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
@@ -238,26 +238,26 @@ cvf::ref<RigResultAccessor>
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
else if ( resVarAddr.m_resultName == RiaResultNames::combinedRiMultResultName() )
|
||||
else if ( resVarAddr.resultName() == RiaResultNames::combinedRiMultResultName() )
|
||||
{
|
||||
CVF_ASSERT( timeStepIndex == 0 ); // Static result, only data for first time step
|
||||
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor( grid );
|
||||
nativeAddr.m_resultName = RiaResultNames::riMultXResultName();
|
||||
nativeAddr.setResultName( RiaResultNames::riMultXResultName() );
|
||||
cvf::ref<RigResultAccessor> xRiMultAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = RiaResultNames::riMultYResultName();
|
||||
nativeAddr.setResultName( RiaResultNames::riMultYResultName() );
|
||||
cvf::ref<RigResultAccessor> yRiMultAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = RiaResultNames::riMultZResultName();
|
||||
nativeAddr.setResultName( RiaResultNames::riMultZResultName() );
|
||||
cvf::ref<RigResultAccessor> zRiMultAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
@@ -269,27 +269,28 @@ cvf::ref<RigResultAccessor>
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
else if ( resVarAddr.m_resultName == RiaResultNames::combinedRiAreaNormTranResultName() )
|
||||
|
||||
else if ( resVarAddr.resultName() == RiaResultNames::combinedRiAreaNormTranResultName() )
|
||||
{
|
||||
CVF_ASSERT( timeStepIndex == 0 ); // Static result, only data for first time step
|
||||
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor( grid );
|
||||
|
||||
nativeAddr.m_resultName = RiaResultNames::riAreaNormTranXResultName();
|
||||
nativeAddr.setResultName( RiaResultNames::riAreaNormTranXResultName() );
|
||||
cvf::ref<RigResultAccessor> xRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = RiaResultNames::riAreaNormTranYResultName();
|
||||
nativeAddr.setResultName( RiaResultNames::riAreaNormTranYResultName() );
|
||||
cvf::ref<RigResultAccessor> yRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = RiaResultNames::riAreaNormTranZResultName();
|
||||
nativeAddr.setResultName( RiaResultNames::riAreaNormTranZResultName() );
|
||||
cvf::ref<RigResultAccessor> zRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
@@ -303,25 +304,26 @@ cvf::ref<RigResultAccessor>
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
else if ( resVarAddr.m_resultName == RiaResultNames::combinedWaterFluxResultName() )
|
||||
|
||||
else if ( resVarAddr.resultName() == RiaResultNames::combinedWaterFluxResultName() )
|
||||
{
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor( grid );
|
||||
|
||||
nativeAddr.m_resultName = "FLRWATI+";
|
||||
nativeAddr.setResultName( "FLRWATI+" );
|
||||
cvf::ref<RigResultAccessor> xRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = "FLRWATJ+";
|
||||
nativeAddr.setResultName( "FLRWATJ+" );
|
||||
cvf::ref<RigResultAccessor> yRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = "FLRWATK+";
|
||||
nativeAddr.setResultName( "FLRWATK+" );
|
||||
cvf::ref<RigResultAccessor> zRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
@@ -335,25 +337,25 @@ cvf::ref<RigResultAccessor>
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
else if ( resVarAddr.m_resultName == RiaResultNames::combinedOilFluxResultName() )
|
||||
else if ( resVarAddr.resultName() == RiaResultNames::combinedOilFluxResultName() )
|
||||
{
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor( grid );
|
||||
|
||||
nativeAddr.m_resultName = "FLROILI+";
|
||||
nativeAddr.setResultName( "FLROILI+" );
|
||||
cvf::ref<RigResultAccessor> xRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = "FLROILJ+";
|
||||
nativeAddr.setResultName( "FLROILJ+" );
|
||||
cvf::ref<RigResultAccessor> yRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = "FLROILK+";
|
||||
nativeAddr.setResultName( "FLROILK+" );
|
||||
cvf::ref<RigResultAccessor> zRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
@@ -367,25 +369,25 @@ cvf::ref<RigResultAccessor>
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
else if ( resVarAddr.m_resultName == RiaResultNames::combinedGasFluxResultName() )
|
||||
else if ( resVarAddr.resultName() == RiaResultNames::combinedGasFluxResultName() )
|
||||
{
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor( grid );
|
||||
|
||||
nativeAddr.m_resultName = "FLRGASI+";
|
||||
nativeAddr.setResultName( "FLRGASI+" );
|
||||
cvf::ref<RigResultAccessor> xRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = "FLRGASJ+";
|
||||
nativeAddr.setResultName( "FLRGASJ+" );
|
||||
cvf::ref<RigResultAccessor> yRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = "FLRGASK+";
|
||||
nativeAddr.setResultName( "FLRGASK+" );
|
||||
cvf::ref<RigResultAccessor> zRiAreaNormTransAccessor =
|
||||
RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
@@ -399,24 +401,24 @@ cvf::ref<RigResultAccessor>
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
else if ( resVarAddr.m_resultName.endsWith( "IJK" ) )
|
||||
else if ( resVarAddr.resultName().endsWith( "IJK" ) )
|
||||
{
|
||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor( grid );
|
||||
QString baseName = resVarAddr.m_resultName.left( resVarAddr.m_resultName.size() - 3 );
|
||||
QString baseName = resVarAddr.resultName().left( resVarAddr.resultName().size() - 3 );
|
||||
|
||||
nativeAddr.m_resultName = QString( "%1I" ).arg( baseName );
|
||||
nativeAddr.setResultName( QString( "%1I" ).arg( baseName ) );
|
||||
cvf::ref<RigResultAccessor> iAccessor = RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = QString( "%1J" ).arg( baseName );
|
||||
nativeAddr.setResultName( QString( "%1J" ).arg( baseName ) );
|
||||
cvf::ref<RigResultAccessor> jAccessor = RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
timeStepIndex,
|
||||
nativeAddr );
|
||||
nativeAddr.m_resultName = QString( "%1K" ).arg( baseName );
|
||||
nativeAddr.setResultName( QString( "%1K" ).arg( baseName ) );
|
||||
cvf::ref<RigResultAccessor> kAccessor = RigResultAccessorFactory::createNativeFromResultAddress( eclipseCase,
|
||||
gridIndex,
|
||||
porosityModel,
|
||||
|
||||
@@ -852,6 +852,26 @@ cvf::Vec3f GeometryTools::polygonAreaNormal3D( const std::vector<cvf::Vec3f>& po
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
float GeometryTools::polygonArea( const std::vector<cvf::Vec3f>& polygon )
|
||||
{
|
||||
auto areaNormal3D = polygonAreaNormal3D( polygon );
|
||||
|
||||
return areaNormal3D.length();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double GeometryTools::polygonArea( const std::vector<cvf::Vec3d>& polygon )
|
||||
{
|
||||
auto areaNormal3D = polygonAreaNormal3D( polygon );
|
||||
|
||||
return areaNormal3D.length();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -81,6 +81,9 @@ public:
|
||||
static cvf::Vec3d polygonAreaNormal3D( const std::vector<cvf::Vec3d>& polygon );
|
||||
static cvf::Vec3f polygonAreaNormal3D( const std::vector<cvf::Vec3f>& polygon );
|
||||
|
||||
static float polygonArea( const std::vector<cvf::Vec3f>& polygon );
|
||||
static double polygonArea( const std::vector<cvf::Vec3d>& polygon );
|
||||
|
||||
enum IntersectionStatus
|
||||
{
|
||||
NO_INTERSECTION,
|
||||
|
||||
Reference in New Issue
Block a user