mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-04 04:30:51 -06:00
NNC : Add settings to preferences and compute on demand
Ported several commits from dev #5913 Import NNC : Do not compute NNCs if importNNCs is disabled in preferences #5914 Import faults : Avoid computation of faults if turned off in preferences #5925 NNC computations : Add flag in preferences to include inactive cells Allan : Do not test for cached data in pytest #5925 Simplify computation of fault data #5932 NNC data : Compute geometry when NNC data is asked for Remove obsolete parameters
This commit is contained in:
parent
72436f0a72
commit
04243dfa64
@ -446,23 +446,27 @@ 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::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 =
|
||||
RiaApplication::instance()->preferences()->readerSettings()->includeInactiveCellsInFaultGeometry;
|
||||
|
||||
mainGrid->nncData()->setSourceDataForProcessing( mainGrid, activeCellInfo, includeInactiveCells );
|
||||
}
|
||||
}
|
||||
|
||||
@ -741,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 );
|
||||
|
@ -48,6 +48,14 @@ bool RifReaderInterface::isNNCsEnabled()
|
||||
return readerSettings()->importNNCs;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifReaderInterface::includeInactiveCellsInFaultGeometry()
|
||||
{
|
||||
return readerSettings()->includeInactiveCellsInFaultGeometry();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -16,14 +16,10 @@ def test_10kSync(rips_instance, initialize_test):
|
||||
case = rips_instance.project.load_case(path=casePath)
|
||||
|
||||
properties = case.available_nnc_properties()
|
||||
assert(len(properties) == 3)
|
||||
assert(len(properties) == 1)
|
||||
|
||||
assert("TRAN" == properties[0].name)
|
||||
assert(NNCProperties_pb2.NNCPropertyType.Value('NNC_STATIC') == properties[0].property_type)
|
||||
assert("Binary Formation Allan" == properties[1].name)
|
||||
assert(NNCProperties_pb2.NNCPropertyType.Value('NNC_GENERATED') == properties[1].property_type)
|
||||
assert("Formation Allan" == properties[2].name)
|
||||
assert(NNCProperties_pb2.NNCPropertyType.Value('NNC_GENERATED') == properties[2].property_type)
|
||||
|
||||
nnc_connections = case.nnc_connections()
|
||||
assert(len(nnc_connections) == 3416)
|
||||
@ -40,12 +36,6 @@ def test_10kSync(rips_instance, initialize_test):
|
||||
for t in tran_vals:
|
||||
assert(isinstance(t, float))
|
||||
|
||||
allan_vals = case.nnc_connections_generated_values("Formation Allan", 0)
|
||||
assert(len(allan_vals) == len(nnc_connections))
|
||||
|
||||
for a in allan_vals:
|
||||
assert(isinstance(a, float))
|
||||
|
||||
# Generate some data
|
||||
new_data = []
|
||||
for (c, _) in enumerate(nnc_connections):
|
||||
|
@ -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 );
|
||||
|
@ -608,7 +608,8 @@ void RimEclipseCase::computeCachedData()
|
||||
|
||||
{
|
||||
auto task = pInf.task( "Calculating faults", 17 );
|
||||
rigEclipseCase->mainGrid()->calculateFaults( rigEclipseCase->activeCellInfo( RiaDefines::MATRIX_MODEL ) );
|
||||
|
||||
ensureFaultDataIsComputed();
|
||||
}
|
||||
|
||||
{
|
||||
@ -689,6 +690,23 @@ void RimEclipseCase::loadAndSyncronizeInputProperties( bool includeGridFileName
|
||||
RifEclipseInputPropertyLoader::loadAndSyncronizeInputProperties( inputPropertyCollection(), eclipseCaseData(), filenames );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseCase::ensureFaultDataIsComputed()
|
||||
{
|
||||
RigEclipseCaseData* rigEclipseCase = eclipseCaseData();
|
||||
if ( rigEclipseCase )
|
||||
{
|
||||
bool computeFaults = RiaApplication::instance()->preferences()->readerSettings()->importFaults();
|
||||
if ( computeFaults )
|
||||
{
|
||||
RigActiveCellInfo* actCellInfo = rigEclipseCase->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
|
||||
rigEclipseCase->mainGrid()->calculateFaults( actCellInfo );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -115,6 +115,8 @@ public:
|
||||
|
||||
void loadAndSyncronizeInputProperties( bool includeGridFileName );
|
||||
|
||||
void ensureFaultDataIsComputed();
|
||||
|
||||
protected:
|
||||
void initAfterRead() override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
@ -21,6 +21,9 @@
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RifReaderSettings.h"
|
||||
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigGridManager.h"
|
||||
@ -75,8 +78,7 @@ RimIdenticalGridCaseGroup* RimEclipseCaseCollection::createIdenticalCaseGroupFro
|
||||
{
|
||||
CVF_ASSERT( mainCase );
|
||||
|
||||
RigEclipseCaseData* rigEclipseCase = mainCase->eclipseCaseData();
|
||||
RigMainGrid* equalGrid = registerCaseInGridCollection( rigEclipseCase );
|
||||
RigMainGrid* equalGrid = registerCaseInGridCollection( mainCase );
|
||||
CVF_ASSERT( equalGrid );
|
||||
|
||||
RimIdenticalGridCaseGroup* group = new RimIdenticalGridCaseGroup;
|
||||
@ -113,9 +115,10 @@ void RimEclipseCaseCollection::removeCaseFromAllGroups( RimEclipseCase* reservoi
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigMainGrid* RimEclipseCaseCollection::registerCaseInGridCollection( RigEclipseCaseData* rigEclipseCase )
|
||||
RigMainGrid* RimEclipseCaseCollection::registerCaseInGridCollection( RimEclipseCase* rimEclipseCase )
|
||||
{
|
||||
CVF_ASSERT( rigEclipseCase );
|
||||
CVF_ASSERT( rimEclipseCase && rimEclipseCase->eclipseCaseData() );
|
||||
RigEclipseCaseData* rigEclipseCase = rimEclipseCase->eclipseCaseData();
|
||||
|
||||
RigMainGrid* equalGrid = m_gridCollection->findEqualGrid( rigEclipseCase->mainGrid() );
|
||||
|
||||
@ -129,7 +132,7 @@ RigMainGrid* RimEclipseCaseCollection::registerCaseInGridCollection( RigEclipseC
|
||||
// This is the first insertion of this grid, compute cached data
|
||||
rigEclipseCase->mainGrid()->computeCachedData();
|
||||
|
||||
rigEclipseCase->mainGrid()->calculateFaults( rigEclipseCase->activeCellInfo( RiaDefines::MATRIX_MODEL ) );
|
||||
rimEclipseCase->ensureFaultDataIsComputed();
|
||||
|
||||
equalGrid = rigEclipseCase->mainGrid();
|
||||
}
|
||||
@ -146,8 +149,7 @@ void RimEclipseCaseCollection::insertCaseInCaseGroup( RimIdenticalGridCaseGroup*
|
||||
{
|
||||
CVF_ASSERT( rimReservoir );
|
||||
|
||||
RigEclipseCaseData* rigEclipseCase = rimReservoir->eclipseCaseData();
|
||||
registerCaseInGridCollection( rigEclipseCase );
|
||||
registerCaseInGridCollection( rimReservoir );
|
||||
|
||||
caseGroup->addCase( rimReservoir );
|
||||
}
|
||||
|
@ -58,6 +58,6 @@ public:
|
||||
void recomputeStatisticsForAllCaseGroups();
|
||||
|
||||
private:
|
||||
RigMainGrid* registerCaseInGridCollection( RigEclipseCaseData* rigEclipseCase );
|
||||
RigMainGrid* registerCaseInGridCollection( RimEclipseCase* rimEclipseCase );
|
||||
cvf::ref<RigGridManager> m_gridCollection;
|
||||
};
|
||||
|
@ -1933,6 +1933,8 @@ void RimEclipseResultDefinition::updateRangesForExplicitLegends( RimRegularLegen
|
||||
int frmIdx2 = it->first.second;
|
||||
int combIndex = it->second;
|
||||
|
||||
if ( frmIdx1 >= fnVector.size() || frmIdx2 >= fnVector.size() ) continue;
|
||||
|
||||
QString frmName1 = fnVector[frmIdx1];
|
||||
QString frmName2 = fnVector[frmIdx2];
|
||||
|
||||
|
@ -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:
|
||||
|
@ -1230,7 +1230,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::DYNAMIC_NATIVE )
|
||||
@ -1371,6 +1376,18 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResult( const RigEclipseResu
|
||||
computeOilVolumes();
|
||||
}
|
||||
|
||||
// Allan results
|
||||
if ( resultName == RiaDefines::formationAllanResultName() || resultName == RiaDefines::formationBinaryAllanResultName() )
|
||||
{
|
||||
bool includeInactiveCells = false;
|
||||
if ( m_readerInterface.notNull() )
|
||||
{
|
||||
includeInactiveCells = m_readerInterface->includeInactiveCellsInFaultGeometry();
|
||||
}
|
||||
|
||||
computeAllanResults( this, m_ownerMainGrid, includeInactiveCells );
|
||||
}
|
||||
|
||||
// Handle SourSimRL reading
|
||||
|
||||
if ( type == RiaDefines::SOURSIMRL )
|
||||
@ -2895,7 +2912,11 @@ void RigCaseCellResultsData::setActiveFormationNames( RigFormationNames* activeF
|
||||
}
|
||||
}
|
||||
|
||||
computeAllanResults( this, m_ownerMainGrid );
|
||||
// As the Allan formation diagram is depending on formation results, we need to clear the data set
|
||||
// Will be recomputed when required
|
||||
auto fnNamesResAddr =
|
||||
RigEclipseResultAddress( RiaDefines::ResultCatType::ALLAN_DIAGRAMS, RiaDefines::formationAllanResultName() );
|
||||
clearScalarResult( fnNamesResAddr );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -3007,17 +3028,18 @@ 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 );
|
||||
|
||||
auto fnNamesResAddr =
|
||||
RigEclipseResultAddress( RiaDefines::FORMATION_NAMES, RiaDefines::activeFormationNamesResultName() );
|
||||
bool hasFormationData = cellResultsData->hasResultEntry( fnNamesResAddr );
|
||||
|
||||
if ( hasFormationData )
|
||||
if ( cellResultsData && cellResultsData->activeFormationNames() &&
|
||||
!cellResultsData->activeFormationNames()->formationNames().empty() )
|
||||
{
|
||||
auto fnNamesResAddr = RigEclipseResultAddress( RiaDefines::ResultCatType::FORMATION_NAMES,
|
||||
RiaDefines::activeFormationNamesResultName() );
|
||||
auto fnAllanResultResAddr =
|
||||
RigEclipseResultAddress( RiaDefines::ALLAN_DIAGRAMS, RiaDefines::formationAllanResultName() );
|
||||
auto fnBinAllanResAddr =
|
||||
|
@ -190,7 +190,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;
|
||||
|
@ -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() )
|
||||
{
|
||||
@ -132,7 +132,8 @@ void assignThreadConnections( RigConnectionContainer& allConnections, RigConnect
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
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
|
||||
@ -173,7 +174,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 );
|
||||
|
@ -48,7 +48,8 @@ public:
|
||||
|
||||
static RigConnectionContainer computeOtherNncs( const RigMainGrid* mainGrid,
|
||||
const RigConnectionContainer& nativeConnections,
|
||||
const RigActiveCellInfo* activeCellInfo );
|
||||
const RigActiveCellInfo* activeCellInfo,
|
||||
bool includeInactiveCells );
|
||||
|
||||
static void extractConnectionsForFace( const RigFault::FaultFace& face,
|
||||
const RigMainGrid* mainGrid,
|
||||
|
@ -555,10 +555,6 @@ void RigMainGrid::calculateFaults( const RigActiveCellInfo* activeCellInfo )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this->nncData()->computeCompleteSetOfNncs( this, activeCellInfo );
|
||||
|
||||
distributeNNCsToFaults();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -566,6 +562,8 @@ void RigMainGrid::calculateFaults( const RigActiveCellInfo* activeCellInfo )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigMainGrid::distributeNNCsToFaults()
|
||||
{
|
||||
if ( m_faultsPrCellAcc.isNull() ) return;
|
||||
|
||||
const RigConnectionContainer& nncs = this->nncData()->connections();
|
||||
for ( size_t nncIdx = 0; nncIdx < nncs.size(); ++nncIdx )
|
||||
{
|
||||
@ -652,7 +650,7 @@ bool RigMainGrid::isFaceNormalsOutwards() const
|
||||
const RigFault* RigMainGrid::findFaultFromCellIndexAndCellFace( size_t reservoirCellIndex,
|
||||
cvf::StructGridInterface::FaceType face ) const
|
||||
{
|
||||
CVF_TIGHT_ASSERT( m_faultsPrCellAcc.notNull() );
|
||||
if ( m_faultsPrCellAcc.isNull() ) return nullptr;
|
||||
|
||||
if ( face == cvf::StructGridInterface::NO_FACE ) return nullptr;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -63,11 +87,12 @@ 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() )
|
||||
{
|
||||
@ -89,9 +114,42 @@ void RigNNCData::computeCompleteSetOfNncs( const RigMainGrid* mainGrid, const Ri
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
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;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -105,8 +163,10 @@ size_t RigNNCData::nativeConnectionCount() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RigConnectionContainer& RigNNCData::connections() const
|
||||
RigConnectionContainer& RigNNCData::connections()
|
||||
{
|
||||
ensureConnectionDataIsProcecced();
|
||||
|
||||
return m_connections;
|
||||
}
|
||||
|
||||
@ -115,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,17 +49,20 @@ public:
|
||||
|
||||
RigNNCData();
|
||||
|
||||
void processNativeConnections( const RigMainGrid& mainGrid );
|
||||
void computeCompleteSetOfNncs( const RigMainGrid* mainGrid, const RigActiveCellInfo* activeCellInfo );
|
||||
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;
|
||||
@ -89,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