#5925 NNC computations : Add flag in preferences to include inactive cells

This commit is contained in:
Magne Sjaastad 2020-05-13 14:20:46 +02:00
parent 0c32538e01
commit c932b40a56
14 changed files with 72 additions and 20 deletions

View File

@ -47,6 +47,14 @@ bool RifReaderInterface::isNNCsEnabled()
return readerSettings()->importNNCs;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RifReaderInterface::includeInactiveCellsInFaultGeometry()
{
return readerSettings()->includeInactiveCellsInFaultGeometry();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -50,6 +50,7 @@ public:
bool isFaultImportEnabled();
bool isImportOfCompleteMswDataEnabled();
bool isNNCsEnabled();
bool includeInactiveCellsInFaultGeometry();
const QString faultIncludeFileAbsolutePathPrefix();
virtual bool open( const QString& fileName, RigEclipseCaseData* eclipseCase ) = 0;

View File

@ -36,6 +36,15 @@ RifReaderSettings::RifReaderSettings()
CAF_PDM_InitField( &importNNCs, "importSimulationNNCs", true, "Import NNCs", "", "", "" );
importNNCs.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitField( &includeInactiveCellsInFaultGeometry,
"includeInactiveCellsInFaultGeometry",
false,
"Include Inactive Cells",
"",
"",
"" );
includeInactiveCellsInFaultGeometry.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
CAF_PDM_InitField( &importAdvancedMswData, "importAdvancedMswData", false, "Import Advanced MSW Data", "", "", "" );
importAdvancedMswData.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
@ -73,7 +82,7 @@ void RifReaderSettings::defineEditorAttribute( const caf::PdmFieldHandle* field,
caf::PdmUiEditorAttribute* attribute )
{
if ( field == &importFaults || field == &importAdvancedMswData || field == &importNNCs ||
field == &useResultIndexFile || field == &skipWellData )
field == &useResultIndexFile || field == &skipWellData || field == &includeInactiveCellsInFaultGeometry )
{
caf::PdmUiCheckBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiCheckBoxEditorAttribute*>( attribute );
if ( myAttr )
@ -89,6 +98,7 @@ void RifReaderSettings::defineEditorAttribute( const caf::PdmFieldHandle* field,
void RifReaderSettings::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &importFaults );
uiOrdering.add( &includeInactiveCellsInFaultGeometry );
#ifdef WIN32
uiOrdering.add( &includeFileAbsolutePathPrefix );
#endif
@ -96,4 +106,10 @@ void RifReaderSettings::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderi
uiOrdering.add( &importAdvancedMswData );
uiOrdering.add( &useResultIndexFile );
uiOrdering.add( &skipWellData );
bool setFaultImportSettingsReadOnly = !importFaults();
includeInactiveCellsInFaultGeometry.uiCapability()->setUiReadOnly( setFaultImportSettingsReadOnly );
includeFileAbsolutePathPrefix.uiCapability()->setUiReadOnly( setFaultImportSettingsReadOnly );
importNNCs.uiCapability()->setUiReadOnly( setFaultImportSettingsReadOnly );
}

View File

@ -37,6 +37,7 @@ public:
caf::PdmField<bool> importFaults;
caf::PdmField<bool> importNNCs;
caf::PdmField<bool> includeInactiveCellsInFaultGeometry;
caf::PdmField<bool> importAdvancedMswData;
caf::PdmField<QString> includeFileAbsolutePathPrefix;
caf::PdmField<bool> useResultIndexFile;

View File

@ -613,10 +613,13 @@ void RimEclipseCase::computeCachedData()
if ( computeFaults )
{
bool computeNncs = RiaApplication::instance()->preferences()->readerSettings()->importNNCs();
bool includeInactiveCells =
RiaApplication::instance()->preferences()->readerSettings()->includeInactiveCellsInFaultGeometry();
rigEclipseCase->mainGrid()->calculateFaults( rigEclipseCase->activeCellInfo(
RiaDefines::PorosityModelType::MATRIX_MODEL ),
computeNncs );
computeNncs,
includeInactiveCells );
}
}

View File

@ -136,9 +136,12 @@ RigMainGrid* RimEclipseCaseCollection::registerCaseInGridCollection( RigEclipseC
if ( computeFaults )
{
bool computeNncs = RiaApplication::instance()->preferences()->readerSettings()->importNNCs();
bool includeInactiveCells =
RiaApplication::instance()->preferences()->readerSettings()->includeInactiveCellsInFaultGeometry();
rigEclipseCase->mainGrid()->calculateFaults( rigEclipseCase->activeCellInfo(
RiaDefines::PorosityModelType::MATRIX_MODEL ),
computeNncs );
computeNncs,
includeInactiveCells );
}
equalGrid = rigEclipseCase->mainGrid();

View File

@ -1279,7 +1279,12 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResult( const RigEclipseResu
else if ( resultName == RiaDefines::formationAllanResultName() ||
resultName == RiaDefines::formationBinaryAllanResultName() )
{
computeAllanResults( this, m_ownerMainGrid );
bool includeInactiveCells = false;
if ( m_readerInterface.notNull() )
{
includeInactiveCells = m_readerInterface->includeInactiveCellsInFaultGeometry();
}
computeAllanResults( this, m_ownerMainGrid, includeInactiveCells );
}
}
else if ( type == RiaDefines::ResultCatType::DYNAMIC_NATIVE )
@ -1313,8 +1318,8 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResult( const RigEclipseResu
{
if ( this->mustBeCalculated( scalarResultIndex ) )
{
// Trigger loading of SWAT, SGAS to establish time step count if no data has been loaded from file at this
// point
// Trigger loading of SWAT, SGAS to establish time step count if no data has been loaded from file at
// this point
findOrLoadKnownScalarResult( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SWAT" ) );
findOrLoadKnownScalarResult( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SGAS" ) );
@ -1423,7 +1428,13 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResult( const RigEclipseResu
// Allan results
if ( resultName == RiaDefines::formationAllanResultName() || resultName == RiaDefines::formationBinaryAllanResultName() )
{
computeAllanResults( this, m_ownerMainGrid );
bool includeInactiveCells = false;
if ( m_readerInterface.notNull() )
{
includeInactiveCells = m_readerInterface->includeInactiveCellsInFaultGeometry();
}
computeAllanResults( this, m_ownerMainGrid, includeInactiveCells );
}
// Handle SourSimRL reading
@ -3083,7 +3094,9 @@ RigStatisticsDataCache* RigCaseCellResultsData::statistics( const RigEclipseResu
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigCaseCellResultsData::computeAllanResults( RigCaseCellResultsData* cellResultsData, RigMainGrid* mainGrid )
void RigCaseCellResultsData::computeAllanResults( RigCaseCellResultsData* cellResultsData,
RigMainGrid* mainGrid,
bool includeInactiveCells )
{
CVF_ASSERT( mainGrid );
CVF_ASSERT( cellResultsData );
@ -3094,7 +3107,7 @@ void RigCaseCellResultsData::computeAllanResults( RigCaseCellResultsData* cellRe
// If import of NNC is disabled in preferences, we must make ensure that computed NNC connections are in place
if ( mainGrid->nncData()->nativeConnectionCount() == mainGrid->nncData()->connections().size() )
{
mainGrid->nncData()->computeCompleteSetOfNncs( mainGrid, cellResultsData->activeCellInfo() );
mainGrid->nncData()->computeCompleteSetOfNncs( mainGrid, cellResultsData->activeCellInfo(), includeInactiveCells );
mainGrid->distributeNNCsToFaults();
}

View File

@ -191,7 +191,8 @@ private:
RigStatisticsDataCache* statistics( const RigEclipseResultAddress& resVarAddr );
static void computeAllanResults( RigCaseCellResultsData* cellResultsData, RigMainGrid* mainGrid );
static void
computeAllanResults( RigCaseCellResultsData* cellResultsData, RigMainGrid* mainGrid, bool includeInactiveCells );
private:
cvf::ref<RifReaderInterface> m_readerInterface;

View File

@ -43,7 +43,7 @@ cvf::StructGridInterface::FaceType
{
// Try to find the shared face
bool isPossibleNeighborInDirection[6] = { true, true, true, true, true, true };
bool isPossibleNeighborInDirection[6] = {true, true, true, true, true, true};
if ( c1.hostGrid() == c2.hostGrid() )
{
@ -143,7 +143,8 @@ void assignThreadConnections( std::set<std::pair<size_t, size_t>>& existingPairs
//--------------------------------------------------------------------------------------------------
RigConnectionContainer RigCellFaceGeometryTools::computeOtherNncs( const RigMainGrid* mainGrid,
const RigConnectionContainer& nativeConnections,
const RigActiveCellInfo* activeCellInfo )
const RigActiveCellInfo* activeCellInfo,
bool includeInactiveCells )
{
// Compute Non-Neighbor Connections (NNC) not reported by Eclipse. NNCs with zero transmissibility are not reported
// by Eclipse. Use faults as basis for subset of cells to find NNC connection for. The imported connections from
@ -185,7 +186,7 @@ RigConnectionContainer RigCellFaceGeometryTools::computeOtherNncs( const RigMain
const RigFault::FaultFace& f = faultFaces[faceIdx];
bool atLeastOneCellActive = true;
if ( activeCellInfo && activeCellInfo->reservoirActiveCellCount() > 0u )
if ( !includeInactiveCells && activeCellInfo && activeCellInfo->reservoirActiveCellCount() > 0u )
{
atLeastOneCellActive = activeCellInfo->isActive( f.m_nativeReservoirCellIndex ) ||
activeCellInfo->isActive( f.m_oppositeReservoirCellIndex );

View File

@ -48,7 +48,8 @@ public:
static RigConnectionContainer computeOtherNncs( const RigMainGrid* mainGrid,
const RigConnectionContainer& nativeConnections,
const RigActiveCellInfo* activeCellInfo );
const RigActiveCellInfo* activeCellInfo,
bool includeInactiveCells );
static RigConnectionContainer extractConnectionsForFace( const RigFault::FaultFace& face,
const RigMainGrid* mainGrid,

View File

@ -413,7 +413,7 @@ bool RigMainGrid::hasFaultWithName( const QString& name ) const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigMainGrid::calculateFaults( const RigActiveCellInfo* activeCellInfo, bool computeNncs )
void RigMainGrid::calculateFaults( const RigActiveCellInfo* activeCellInfo, bool computeNncs, bool includeInactiveCells )
{
if ( hasFaultWithName( RiaDefines::undefinedGridFaultName() ) &&
hasFaultWithName( RiaDefines::undefinedGridFaultWithInactiveName() ) )
@ -558,7 +558,7 @@ void RigMainGrid::calculateFaults( const RigActiveCellInfo* activeCellInfo, bool
if ( computeNncs )
{
this->nncData()->computeCompleteSetOfNncs( this, activeCellInfo );
this->nncData()->computeCompleteSetOfNncs( this, activeCellInfo, includeInactiveCells );
}
distributeNNCsToFaults();

View File

@ -70,7 +70,7 @@ public:
void setFaults( const cvf::Collection<RigFault>& faults );
const cvf::Collection<RigFault>& faults() const;
cvf::Collection<RigFault>& faults();
void calculateFaults( const RigActiveCellInfo* activeCellInfo, bool computeNncs );
void calculateFaults( const RigActiveCellInfo* activeCellInfo, bool computeNncs, bool includeInactiveCells );
void distributeNNCsToFaults();

View File

@ -75,12 +75,14 @@ void RigNNCData::processNativeConnections( const RigMainGrid& mainGrid )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigNNCData::computeCompleteSetOfNncs( const RigMainGrid* mainGrid, const RigActiveCellInfo* activeCellInfo )
void RigNNCData::computeCompleteSetOfNncs( const RigMainGrid* mainGrid,
const RigActiveCellInfo* activeCellInfo,
bool includeInactiveCells )
{
m_nativeConnectionCount = m_connections.size();
RigConnectionContainer otherConnections =
RigCellFaceGeometryTools::computeOtherNncs( mainGrid, m_connections, activeCellInfo );
RigCellFaceGeometryTools::computeOtherNncs( mainGrid, m_connections, activeCellInfo, includeInactiveCells );
if ( !otherConnections.empty() )
{

View File

@ -50,7 +50,9 @@ public:
RigNNCData();
void processNativeConnections( const RigMainGrid& mainGrid );
void computeCompleteSetOfNncs( const RigMainGrid* mainGrid, const RigActiveCellInfo* activeCellInfo );
void computeCompleteSetOfNncs( const RigMainGrid* mainGrid,
const RigActiveCellInfo* activeCellInfo,
bool includeInactiveCells );
void setConnections( RigConnectionContainer& connections );
size_t nativeConnectionCount() const;