mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5932 NNC data : Compute geometry when NNC data is asked for
This commit is contained in:
parent
ab0b05b31c
commit
0c13f132fa
@ -447,23 +447,26 @@ bool RifReaderEclipseOutput::open( const QString& fileName, RigEclipseCaseData*
|
||||
if ( isNNCsEnabled() )
|
||||
{
|
||||
caf::ProgressInfo nncProgress( 10, "" );
|
||||
RigMainGrid* mainGrid = eclipseCase->mainGrid();
|
||||
|
||||
{
|
||||
auto subNncTask = nncProgress.task( "Reading static NNC data" );
|
||||
transferStaticNNCData( mainEclGrid, m_ecl_init_file, eclipseCase->mainGrid() );
|
||||
transferStaticNNCData( mainEclGrid, m_ecl_init_file, mainGrid );
|
||||
}
|
||||
|
||||
// This test should probably be improved to test more directly for presence of NNC data
|
||||
if ( m_eclipseCase->results( RiaDefines::PorosityModelType::MATRIX_MODEL )->hasFlowDiagUsableFluxes() )
|
||||
{
|
||||
auto subNncTask = nncProgress.task( "Reading dynamic NNC data" );
|
||||
transferDynamicNNCData( mainEclGrid, eclipseCase->mainGrid() );
|
||||
transferDynamicNNCData( mainEclGrid, mainGrid );
|
||||
}
|
||||
|
||||
{
|
||||
auto subNncTask = nncProgress.task( "Processing connections", 8 );
|
||||
eclipseCase->mainGrid()->nncData()->processNativeConnections( *( eclipseCase->mainGrid() ) );
|
||||
}
|
||||
RigActiveCellInfo* activeCellInfo =
|
||||
m_eclipseCase->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
|
||||
|
||||
bool includeInactiveCells = RiaPreferences::current()->readerSettings()->includeInactiveCellsInFaultGeometry;
|
||||
|
||||
mainGrid->nncData()->setSourceDataForProcessing( mainGrid, activeCellInfo, includeInactiveCells );
|
||||
}
|
||||
}
|
||||
|
||||
@ -742,11 +745,9 @@ void RifReaderEclipseOutput::transferStaticNNCData( const ecl_grid_type* mainEcl
|
||||
transmissibilityValuesTemp.push_back( transValues[nIdx] );
|
||||
}
|
||||
|
||||
mainGrid->nncData()->setConnections( nncConnections );
|
||||
|
||||
std::vector<double>& transmissibilityValues =
|
||||
mainGrid->nncData()->makeStaticConnectionScalarResult( RiaDefines::propertyNameCombTrans() );
|
||||
transmissibilityValues = transmissibilityValuesTemp;
|
||||
mainGrid->nncData()->setNativeConnections( nncConnections );
|
||||
mainGrid->nncData()->makeScalarResultAndSetValues( RiaDefines::propertyNameCombTrans(),
|
||||
transmissibilityValuesTemp );
|
||||
}
|
||||
|
||||
ecl_nnc_data_free( tran_data );
|
||||
|
@ -32,7 +32,7 @@
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivNNCGeometryGenerator::RivNNCGeometryGenerator( bool includeAllan,
|
||||
const RigNNCData* nncData,
|
||||
RigNNCData* nncData,
|
||||
const cvf::Vec3d& offset,
|
||||
const cvf::Array<size_t>* nncIndexes )
|
||||
: m_includeAllanDiagramGeometry( includeAllan )
|
||||
|
@ -43,7 +43,7 @@ class RivNNCGeometryGenerator : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RivNNCGeometryGenerator( bool includeAllan,
|
||||
const RigNNCData* nncData,
|
||||
RigNNCData* nncData,
|
||||
const cvf::Vec3d& offset,
|
||||
const cvf::Array<size_t>* nncIndexes );
|
||||
|
||||
@ -70,7 +70,7 @@ private:
|
||||
bool m_includeAllanDiagramGeometry;
|
||||
|
||||
// Input
|
||||
cvf::cref<RigNNCData> m_nncData;
|
||||
cvf::ref<RigNNCData> m_nncData;
|
||||
cvf::cref<cvf::Array<size_t>> m_nncIndexes;
|
||||
cvf::cref<cvf::UByteArray> m_cellVisibility;
|
||||
cvf::cref<RigGridBase> m_grid;
|
||||
|
@ -201,6 +201,9 @@ void RivReservoirFaultsPartMgr::appendPartsToModel( cvf::ModelBasicList* model )
|
||||
|
||||
if ( showNncs )
|
||||
{
|
||||
RigMainGrid* mainGrid = m_reservoirView->mainGrid();
|
||||
mainGrid->nncData()->ensureConnectionDataIsProcecced();
|
||||
|
||||
if ( showCompleteNncGeo )
|
||||
{
|
||||
rivFaultPart->appendCompleteNNCFacesToModel( &parts );
|
||||
|
@ -89,15 +89,6 @@ RimFaultInViewCollection::RimFaultInViewCollection()
|
||||
"",
|
||||
"" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &noCommonAreaNnncCollection,
|
||||
"NoCommonAreaNnncCollection",
|
||||
"NNCs With No Common Area",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
noCommonAreaNnncCollection = new RimNoCommonAreaNncCollection;
|
||||
noCommonAreaNnncCollection.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &faults, "Faults", "Faults", "", "", "" );
|
||||
faults.uiCapability()->setUiHidden( true );
|
||||
}
|
||||
@ -108,8 +99,6 @@ RimFaultInViewCollection::RimFaultInViewCollection()
|
||||
RimFaultInViewCollection::~RimFaultInViewCollection()
|
||||
{
|
||||
faults.deleteAllChildObjects();
|
||||
|
||||
delete noCommonAreaNnncCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -262,73 +251,6 @@ void RimFaultInViewCollection::syncronizeFaults()
|
||||
|
||||
QString toolTip = QString( "Fault count (%1)" ).arg( newFaults.size() );
|
||||
setUiToolTip( toolTip );
|
||||
|
||||
// NNCs
|
||||
this->noCommonAreaNnncCollection()->noCommonAreaNncs().deleteAllChildObjects();
|
||||
|
||||
RigMainGrid* mainGrid = parentView()->mainGrid();
|
||||
const RigConnectionContainer& nncConnections = mainGrid->nncData()->connections();
|
||||
for ( size_t connIndex = 0; connIndex < nncConnections.size(); connIndex++ )
|
||||
{
|
||||
if ( !nncConnections[connIndex].hasCommonArea() )
|
||||
{
|
||||
RimNoCommonAreaNNC* noCommonAreaNnc = new RimNoCommonAreaNNC();
|
||||
|
||||
QString firstConnectionText;
|
||||
QString secondConnectionText;
|
||||
|
||||
{
|
||||
size_t gridLocalCellIndex;
|
||||
const RigGridBase* hostGrid =
|
||||
mainGrid->gridAndGridLocalIdxFromGlobalCellIdx( nncConnections[connIndex].c1GlobIdx(),
|
||||
&gridLocalCellIndex );
|
||||
|
||||
size_t i, j, k;
|
||||
if ( hostGrid->ijkFromCellIndex( gridLocalCellIndex, &i, &j, &k ) )
|
||||
{
|
||||
// Adjust to 1-based Eclipse indexing
|
||||
i++;
|
||||
j++;
|
||||
k++;
|
||||
|
||||
if ( !hostGrid->isMainGrid() )
|
||||
{
|
||||
QString gridName = QString::fromStdString( hostGrid->gridName() );
|
||||
firstConnectionText = gridName + " ";
|
||||
}
|
||||
firstConnectionText += QString( "[%1 %2 %3] - " ).arg( i ).arg( j ).arg( k );
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
size_t gridLocalCellIndex;
|
||||
const RigGridBase* hostGrid =
|
||||
mainGrid->gridAndGridLocalIdxFromGlobalCellIdx( nncConnections[connIndex].c2GlobIdx(),
|
||||
&gridLocalCellIndex );
|
||||
|
||||
size_t i, j, k;
|
||||
if ( hostGrid->ijkFromCellIndex( gridLocalCellIndex, &i, &j, &k ) )
|
||||
{
|
||||
// Adjust to 1-based Eclipse indexing
|
||||
i++;
|
||||
j++;
|
||||
k++;
|
||||
|
||||
if ( !hostGrid->isMainGrid() )
|
||||
{
|
||||
QString gridName = QString::fromStdString( hostGrid->gridName() );
|
||||
secondConnectionText = gridName + " ";
|
||||
}
|
||||
secondConnectionText += QString( "[%1 %2 %3]" ).arg( i ).arg( j ).arg( k );
|
||||
}
|
||||
}
|
||||
|
||||
noCommonAreaNnc->name = firstConnectionText + secondConnectionText;
|
||||
this->noCommonAreaNnncCollection()->noCommonAreaNncs().push_back( noCommonAreaNnc );
|
||||
}
|
||||
|
||||
this->noCommonAreaNnncCollection()->updateName();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -77,8 +77,6 @@ public:
|
||||
caf::PdmChildArrayField<RimFaultInView*> faults;
|
||||
RimFaultInView* findFaultByName( QString name );
|
||||
|
||||
caf::PdmChildField<RimNoCommonAreaNncCollection*> noCommonAreaNnncCollection;
|
||||
|
||||
void uiOrderingFaults( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
|
||||
|
||||
private:
|
||||
|
@ -3105,13 +3105,6 @@ void RigCaseCellResultsData::computeAllanResults( RigCaseCellResultsData* cellRe
|
||||
if ( cellResultsData && cellResultsData->activeFormationNames() &&
|
||||
!cellResultsData->activeFormationNames()->formationNames().empty() )
|
||||
{
|
||||
// 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(), includeInactiveCells );
|
||||
mainGrid->distributeNNCsToFaults();
|
||||
}
|
||||
|
||||
auto fnNamesResAddr = RigEclipseResultAddress( RiaDefines::ResultCatType::FORMATION_NAMES,
|
||||
RiaDefines::activeFormationNamesResultName() );
|
||||
auto fnAllanResultResAddr =
|
||||
|
@ -555,13 +555,6 @@ void RigMainGrid::calculateFaults( const RigActiveCellInfo* activeCellInfo, bool
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( computeNncs )
|
||||
{
|
||||
this->nncData()->computeCompleteSetOfNncs( this, activeCellInfo, includeInactiveCells );
|
||||
}
|
||||
|
||||
distributeNNCsToFaults();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -66,7 +66,8 @@ public:
|
||||
|
||||
size_t totalTemporaryGridCellCount() const;
|
||||
|
||||
RigNNCData* nncData();
|
||||
RigNNCData* nncData();
|
||||
|
||||
void setFaults( const cvf::Collection<RigFault>& faults );
|
||||
const cvf::Collection<RigFault>& faults() const;
|
||||
cvf::Collection<RigFault>& faults();
|
||||
|
@ -23,15 +23,39 @@
|
||||
#include "RigEclipseResultAddress.h"
|
||||
#include "RigMainGrid.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "cafProgressInfo.h"
|
||||
|
||||
#include "cvfGeometryTools.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigNNCData::RigNNCData()
|
||||
: m_connectionsAreProcessed( false )
|
||||
, m_mainGrid( nullptr )
|
||||
, m_activeCellInfo( nullptr )
|
||||
, m_computeNncForInactiveCells( false )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigNNCData::setSourceDataForProcessing( RigMainGrid* mainGrid,
|
||||
const RigActiveCellInfo* activeCellInfo,
|
||||
bool includeInactiveCells )
|
||||
{
|
||||
m_mainGrid = mainGrid;
|
||||
m_activeCellInfo = activeCellInfo;
|
||||
m_computeNncForInactiveCells = includeInactiveCells;
|
||||
|
||||
m_connectionsAreProcessed = false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -67,7 +91,6 @@ void RigNNCData::computeCompleteSetOfNncs( const RigMainGrid* mainGrid,
|
||||
const RigActiveCellInfo* activeCellInfo,
|
||||
bool includeInactiveCells )
|
||||
{
|
||||
m_nativeConnectionCount = m_connections.size();
|
||||
RigConnectionContainer otherConnections =
|
||||
RigCellFaceGeometryTools::computeOtherNncs( mainGrid, m_connections, activeCellInfo, includeInactiveCells );
|
||||
|
||||
@ -91,9 +114,42 @@ void RigNNCData::computeCompleteSetOfNncs( const RigMainGrid* mainGrid,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigNNCData::setConnections( RigConnectionContainer& connections )
|
||||
void RigNNCData::ensureConnectionDataIsProcecced()
|
||||
{
|
||||
m_connections = connections;
|
||||
if ( m_connectionsAreProcessed ) return;
|
||||
|
||||
if ( m_mainGrid )
|
||||
{
|
||||
caf::ProgressInfo progressInfo( 3, "Computing NNC Data" );
|
||||
|
||||
RiaLogging::info( "NNC geometry computation - starting process" );
|
||||
|
||||
processNativeConnections( *m_mainGrid );
|
||||
progressInfo.incrementProgress();
|
||||
|
||||
computeCompleteSetOfNncs( m_mainGrid, m_activeCellInfo, m_computeNncForInactiveCells );
|
||||
progressInfo.incrementProgress();
|
||||
|
||||
m_connectionsAreProcessed = true;
|
||||
|
||||
m_mainGrid->distributeNNCsToFaults();
|
||||
|
||||
RiaLogging::info( "NNC geometry computation - completed process" );
|
||||
|
||||
RiaLogging::info( QString( "Native NNC count : %1" ).arg( nativeConnectionCount() ) );
|
||||
RiaLogging::info( QString( "Computed NNC count : %2" ).arg( m_connections.size() ) );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigNNCData::setNativeConnections( RigConnectionContainer& connections )
|
||||
{
|
||||
m_connections = connections;
|
||||
m_nativeConnectionCount = m_connections.size();
|
||||
|
||||
m_connectionsAreProcessed = false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -107,8 +163,10 @@ size_t RigNNCData::nativeConnectionCount() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RigConnectionContainer& RigNNCData::connections() const
|
||||
RigConnectionContainer& RigNNCData::connections()
|
||||
{
|
||||
ensureConnectionDataIsProcecced();
|
||||
|
||||
return m_connections;
|
||||
}
|
||||
|
||||
@ -117,12 +175,24 @@ const RigConnectionContainer& RigNNCData::connections() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double>& RigNNCData::makeStaticConnectionScalarResult( QString nncDataType )
|
||||
{
|
||||
ensureConnectionDataIsProcecced();
|
||||
|
||||
std::vector<std::vector<double>>& results = m_connectionResults[nncDataType];
|
||||
results.resize( 1 );
|
||||
results[0].resize( m_connections.size(), HUGE_VAL );
|
||||
return results[0];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigNNCData::makeScalarResultAndSetValues( const QString& nncDataType, const std::vector<double>& values )
|
||||
{
|
||||
std::vector<std::vector<double>>& results = m_connectionResults[nncDataType];
|
||||
results.resize( 1 );
|
||||
results[0] = values;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -49,19 +49,20 @@ public:
|
||||
|
||||
RigNNCData();
|
||||
|
||||
void processNativeConnections( const RigMainGrid& mainGrid );
|
||||
void computeCompleteSetOfNncs( const RigMainGrid* mainGrid,
|
||||
const RigActiveCellInfo* activeCellInfo,
|
||||
bool includeInactiveCells );
|
||||
void ensureConnectionDataIsProcecced();
|
||||
void setSourceDataForProcessing( RigMainGrid* mainGrid,
|
||||
const RigActiveCellInfo* activeCellInfo,
|
||||
bool includeInactiveCells );
|
||||
|
||||
void setConnections( RigConnectionContainer& connections );
|
||||
void setNativeConnections( RigConnectionContainer& connections );
|
||||
size_t nativeConnectionCount() const;
|
||||
|
||||
const RigConnectionContainer& connections() const;
|
||||
RigConnectionContainer& connections();
|
||||
|
||||
std::vector<double>& makeStaticConnectionScalarResult( QString nncDataType );
|
||||
const std::vector<double>* staticConnectionScalarResult( const RigEclipseResultAddress& resVarAddr ) const;
|
||||
const std::vector<double>* staticConnectionScalarResultByName( const QString& nncDataType ) const;
|
||||
void makeScalarResultAndSetValues( const QString& nncDataType, const std::vector<double>& values );
|
||||
|
||||
std::vector<std::vector<double>>& makeDynamicConnectionScalarResult( QString nncDataType, size_t timeStepCount );
|
||||
const std::vector<std::vector<double>>* dynamicConnectionScalarResult( const RigEclipseResultAddress& resVarAddr ) const;
|
||||
@ -91,9 +92,19 @@ private:
|
||||
const QString getNNCDataTypeFromScalarResultIndex( const RigEclipseResultAddress& resVarAddr ) const;
|
||||
bool isNative( QString nncDataType ) const;
|
||||
|
||||
void processNativeConnections( const RigMainGrid& mainGrid );
|
||||
void computeCompleteSetOfNncs( const RigMainGrid* mainGrid,
|
||||
const RigActiveCellInfo* activeCellInfo,
|
||||
bool includeInactiveCells );
|
||||
|
||||
private:
|
||||
RigConnectionContainer m_connections;
|
||||
size_t m_nativeConnectionCount;
|
||||
std::map<QString, std::vector<std::vector<double>>> m_connectionResults;
|
||||
std::map<RigEclipseResultAddress, QString> m_resultAddrToNNCDataType;
|
||||
|
||||
bool m_connectionsAreProcessed;
|
||||
RigMainGrid* m_mainGrid;
|
||||
const RigActiveCellInfo* m_activeCellInfo;
|
||||
bool m_computeNncForInactiveCells;
|
||||
};
|
||||
|
@ -558,7 +558,7 @@ void RigReservoirBuilderMock::addFaults( RigEclipseCaseData* eclipseCase )
|
||||
addNnc( grid, i1, j1, k1, i2, j2, k2, nncConnections );
|
||||
}
|
||||
|
||||
grid->nncData()->setConnections( nncConnections );
|
||||
grid->nncData()->setNativeConnections( nncConnections );
|
||||
|
||||
std::vector<double>& tranVals =
|
||||
grid->nncData()->makeStaticConnectionScalarResult( RiaDefines::propertyNameCombTrans() );
|
||||
|
Loading…
Reference in New Issue
Block a user