mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5200 New allen result type, and working full and binary allen diagrams for formations
This commit is contained in:
@@ -16,6 +16,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RigCombMultResultAccessor.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigResultModifier.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigResultModifierFactory.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigFormationNames.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigAllenDiagramData.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagResultAddress.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagResults.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagResultFrames.h
|
||||
@@ -91,6 +92,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RigCombTransResultAccessor.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigCombMultResultAccessor.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigResultModifierFactory.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigFormationNames.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigAllenDiagramData.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagResultAddress.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagResults.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigFlowDiagResultFrames.cpp
|
||||
|
||||
33
ApplicationCode/ReservoirDataModel/RigAllenDiagramData.cpp
Normal file
33
ApplicationCode/ReservoirDataModel/RigAllenDiagramData.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RigAllenDiagramData.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigFormationNames.h"
|
||||
#include "RigMainGrid.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigAllenDiagramData::RigAllenDiagramData() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigAllenDiagramData::~RigAllenDiagramData() {}
|
||||
44
ApplicationCode/ReservoirDataModel/RigAllenDiagramData.h
Normal file
44
ApplicationCode/ReservoirDataModel/RigAllenDiagramData.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfObject.h"
|
||||
#include <QString>
|
||||
|
||||
#include <map>
|
||||
|
||||
class RigAllenDiagramData : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RigAllenDiagramData();
|
||||
~RigAllenDiagramData() override;
|
||||
|
||||
const std::map<std::pair<int, int>, int>& formationCombinationToCategory()
|
||||
{
|
||||
return m_formationCombinationToCategory;
|
||||
}
|
||||
|
||||
void setFormationCombinationToCategorymap( const std::map<std::pair<int, int>, int>& mapping )
|
||||
{
|
||||
m_formationCombinationToCategory = mapping;
|
||||
}
|
||||
|
||||
private:
|
||||
std::map<std::pair<int, int>, int> m_formationCombinationToCategory;
|
||||
};
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RigAllenDiagramData.h"
|
||||
#include "RigCaseCellResultCalculator.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigEclipseMultiPropertyStatCalc.h"
|
||||
@@ -61,6 +62,8 @@ RigCaseCellResultsData::RigCaseCellResultsData( RigEclipseCaseData* ow
|
||||
|
||||
m_ownerCaseData = ownerCaseData;
|
||||
m_ownerMainGrid = ownerCaseData->mainGrid();
|
||||
|
||||
m_allenDiagramData = new RigAllenDiagramData;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -2892,6 +2895,14 @@ RigFormationNames* RigCaseCellResultsData::activeFormationNames()
|
||||
return m_activeFormationNamesData.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigAllenDiagramData* RigCaseCellResultsData::allenDiagramData()
|
||||
{
|
||||
return m_allenDiagramData.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// If we have any results on any time step, assume we have loaded results
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -2990,64 +3001,65 @@ void RigCaseCellResultsData::computeAllenResults( RigCaseCellResultsData* cellRe
|
||||
CVF_ASSERT( mainGrid );
|
||||
CVF_ASSERT( cellResultsData );
|
||||
|
||||
auto allAllenEclResAddr = RigEclipseResultAddress( RiaDefines::ALLEN_DIAGRAMS,
|
||||
RiaDefines::allCombinationsAllenResultName() );
|
||||
|
||||
auto binaryAllenEclResAddr = RigEclipseResultAddress( RiaDefines::ALLEN_DIAGRAMS,
|
||||
RiaDefines::binaryAllenResultName() );
|
||||
|
||||
if ( mainGrid->nncData()->staticConnectionScalarResult( allAllenEclResAddr ) ) return;
|
||||
|
||||
std::vector<double>& allAllenResults = mainGrid->nncData()->makeStaticConnectionScalarResult(
|
||||
RiaDefines::allCombinationsAllenResultName() );
|
||||
|
||||
std::vector<double>& allAllenFormationResults = mainGrid->nncData()->makeStaticConnectionScalarResult(
|
||||
RiaDefines::activeFormationNamesResultName() );
|
||||
|
||||
std::vector<double>& binaryAllenResults = mainGrid->nncData()->makeStaticConnectionScalarResult(
|
||||
RiaDefines::binaryAllenResultName() );
|
||||
|
||||
mainGrid->nncData()->setEclResultAddress( RiaDefines::allCombinationsAllenResultName(), allAllenEclResAddr );
|
||||
mainGrid->nncData()->setEclResultAddress( RiaDefines::binaryAllenResultName(), binaryAllenEclResAddr );
|
||||
mainGrid->nncData()->setEclResultAddress( RiaDefines::activeFormationNamesResultName(),
|
||||
RigEclipseResultAddress( RiaDefines::FORMATION_NAMES,
|
||||
RiaDefines::activeFormationNamesResultName() ) );
|
||||
|
||||
bool hasFormationData = cellResultsData->hasResultEntry(
|
||||
RigEclipseResultAddress( RiaDefines::FORMATION_NAMES, RiaDefines::activeFormationNamesResultName() ) );
|
||||
auto fnNamesResAddr = RigEclipseResultAddress( RiaDefines::FORMATION_NAMES,
|
||||
RiaDefines::activeFormationNamesResultName() );
|
||||
bool hasFormationData = cellResultsData->hasResultEntry( fnNamesResAddr );
|
||||
|
||||
if ( hasFormationData )
|
||||
{
|
||||
const std::vector<double>& fnData =
|
||||
cellResultsData->cellScalarResults( RigEclipseResultAddress( RiaDefines::FORMATION_NAMES,
|
||||
RiaDefines::activeFormationNamesResultName() ),
|
||||
0 );
|
||||
auto fnAllenResultResAddr = RigEclipseResultAddress( RiaDefines::ALLEN_DIAGRAMS,
|
||||
RiaDefines::allCombinationsAllenResultName() );
|
||||
auto fnBinAllenResAddr = RigEclipseResultAddress( RiaDefines::ALLEN_DIAGRAMS,
|
||||
RiaDefines::binaryAllenResultName() );
|
||||
|
||||
// Create and retreive nnc result arrays
|
||||
|
||||
std::vector<double>& fnAllenNncResults = mainGrid->nncData()->makeStaticConnectionScalarResult(
|
||||
RiaDefines::allCombinationsAllenResultName() );
|
||||
std::vector<double>& fnBinAllenNncResults = mainGrid->nncData()->makeStaticConnectionScalarResult(
|
||||
RiaDefines::binaryAllenResultName() );
|
||||
|
||||
// Associate them with eclipse result address
|
||||
|
||||
mainGrid->nncData()->setEclResultAddress( RiaDefines::allCombinationsAllenResultName(), fnAllenResultResAddr );
|
||||
mainGrid->nncData()->setEclResultAddress( RiaDefines::binaryAllenResultName(), fnBinAllenResAddr );
|
||||
|
||||
const std::vector<double>& fnData = cellResultsData->cellScalarResults( fnNamesResAddr, 0 );
|
||||
|
||||
// Add a result entry for the special allen grid data (used only for the grid cells without nnc coverage)
|
||||
|
||||
cellResultsData->addStaticScalarResult( RiaDefines::ALLEN_DIAGRAMS,
|
||||
RiaDefines::allCombinationsAllenResultName(),
|
||||
false,
|
||||
fnData.size() );
|
||||
cellResultsData->addStaticScalarResult( RiaDefines::ALLEN_DIAGRAMS,
|
||||
RiaDefines::binaryAllenResultName(),
|
||||
false,
|
||||
fnData.size() );
|
||||
|
||||
std::vector<double>* alData = cellResultsData->modifiableCellScalarResult( allAllenEclResAddr, 0 );
|
||||
std::vector<double>* alData = cellResultsData->modifiableCellScalarResult( fnAllenResultResAddr, 0 );
|
||||
std::vector<double>* binAlData = cellResultsData->modifiableCellScalarResult( fnBinAllenResAddr, 0 );
|
||||
|
||||
( *alData ) = fnData;
|
||||
|
||||
std::map<std::pair<int, int>, int> formationCombinationToCategory;
|
||||
|
||||
for ( size_t i = 0; i < mainGrid->nncData()->connections().size(); i++ )
|
||||
for ( double& val : ( *binAlData ) )
|
||||
{
|
||||
const auto& c = mainGrid->nncData()->connections()[i];
|
||||
val = 0.0;
|
||||
}
|
||||
|
||||
size_t formationCount = cellResultsData->activeFormationNames()->formationNames().size();
|
||||
|
||||
const std::vector<RigConnection>& nncConnections = mainGrid->nncData()->connections();
|
||||
|
||||
std::map<std::pair<int, int>, int> formationCombinationToCategory;
|
||||
for ( size_t i = 0; i < nncConnections.size(); i++ )
|
||||
{
|
||||
const auto& c = nncConnections[i];
|
||||
|
||||
size_t globCellIdx1 = c.m_c1GlobIdx;
|
||||
size_t globCellIdx2 = c.m_c2GlobIdx;
|
||||
|
||||
size_t i1, j1, k1;
|
||||
mainGrid->ijkFromCellIndex( globCellIdx1, &i1, &j1, &k1 );
|
||||
|
||||
int formation1 = (int)( fnData[globCellIdx1] );
|
||||
|
||||
size_t i2, j2, k2;
|
||||
mainGrid->ijkFromCellIndex( globCellIdx2, &i2, &j2, &k2 );
|
||||
int formation2 = (int)( fnData[globCellIdx2] );
|
||||
|
||||
int category = -1;
|
||||
@@ -3067,7 +3079,7 @@ void RigCaseCellResultsData::computeAllenResults( RigCaseCellResultsData* cellRe
|
||||
}
|
||||
else
|
||||
{
|
||||
category = static_cast<int>( formationCombinationToCategory.size() );
|
||||
category = static_cast<int>( formationCombinationToCategory.size() + formationCount );
|
||||
|
||||
formationCombinationToCategory[formationCombination] = category;
|
||||
}
|
||||
@@ -3075,20 +3087,21 @@ void RigCaseCellResultsData::computeAllenResults( RigCaseCellResultsData* cellRe
|
||||
|
||||
if ( category < 0 )
|
||||
{
|
||||
binaryAllenResults[i] = 0.0;
|
||||
allAllenResults[i] = std::numeric_limits<double>::max();
|
||||
allAllenFormationResults[i] = std::numeric_limits<double>::max();
|
||||
fnBinAllenNncResults[i] = 0.0;
|
||||
fnAllenNncResults[i] = std::numeric_limits<double>::max();
|
||||
}
|
||||
else
|
||||
{
|
||||
binaryAllenResults[i] = 1.0;
|
||||
allAllenResults[i] = category;
|
||||
allAllenFormationResults[i] = formation1;
|
||||
fnBinAllenNncResults[i] = 1.0;
|
||||
fnAllenNncResults[i] = category;
|
||||
}
|
||||
}
|
||||
|
||||
cellResultsData->allenDiagramData()->setFormationCombinationToCategorymap( formationCombinationToCategory );
|
||||
}
|
||||
else
|
||||
{
|
||||
#if 0
|
||||
for ( size_t i = 0; i < mainGrid->nncData()->connections().size(); i++ )
|
||||
{
|
||||
const auto& c = mainGrid->nncData()->connections()[i];
|
||||
@@ -3108,10 +3121,11 @@ void RigCaseCellResultsData::computeAllenResults( RigCaseCellResultsData* cellRe
|
||||
binaryValue = 1.0;
|
||||
}
|
||||
|
||||
allAllenResults[i] = k1;
|
||||
fnAllenNncResults[i] = k1;
|
||||
allAllenFormationResults[i] = k1;
|
||||
binaryAllenResults[i] = binaryValue;
|
||||
fnBinAllenNncResults[i] = binaryValue;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ class RigStatisticsDataCache;
|
||||
class RigEclipseTimeStepInfo;
|
||||
class RigEclipseCaseData;
|
||||
class RigFormationNames;
|
||||
class RigAllenDiagramData;
|
||||
|
||||
class RimEclipseCase;
|
||||
|
||||
@@ -58,6 +59,7 @@ public:
|
||||
void setHdf5Filename( const QString& hdf5SourSimFilename );
|
||||
void setActiveFormationNames( RigFormationNames* activeFormationNames );
|
||||
RigFormationNames* activeFormationNames();
|
||||
RigAllenDiagramData* allenDiagramData();
|
||||
|
||||
void setMainGrid( RigMainGrid* ownerGrid );
|
||||
void setActiveCellInfo( RigActiveCellInfo* activeCellInfo );
|
||||
@@ -194,8 +196,9 @@ private:
|
||||
static void computeAllenResults( RigCaseCellResultsData* cellResultsData, RigMainGrid* mainGrid );
|
||||
|
||||
private:
|
||||
cvf::ref<RifReaderInterface> m_readerInterface;
|
||||
cvf::ref<RigFormationNames> m_activeFormationNamesData;
|
||||
cvf::ref<RifReaderInterface> m_readerInterface;
|
||||
cvf::ref<RigFormationNames> m_activeFormationNamesData;
|
||||
cvf::ref<RigAllenDiagramData> m_allenDiagramData;
|
||||
|
||||
std::vector<std::vector<std::vector<double>>>
|
||||
m_cellScalarResults; ///< Scalar results on the complete reservoir for each Result index (ResultVariable) and timestep
|
||||
|
||||
@@ -60,5 +60,6 @@ private:
|
||||
accumulator.addValue( v );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -732,6 +732,14 @@ RigFormationNames* RigEclipseCaseData::activeFormationNames()
|
||||
return m_matrixModelResults->activeFormationNames();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigAllenDiagramData* RigEclipseCaseData::allenDiagramData()
|
||||
{
|
||||
return m_matrixModelResults->allenDiagramData();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -47,6 +47,7 @@ class RigWellPath;
|
||||
class RimEclipseCase;
|
||||
class RigVirtualPerforationTransmissibilities;
|
||||
class RigEquil;
|
||||
class RigAllenDiagramData;
|
||||
|
||||
struct RigWellResultPoint;
|
||||
|
||||
@@ -88,9 +89,10 @@ public:
|
||||
|
||||
bool hasFractureResults() const;
|
||||
|
||||
void setActiveFormationNames( RigFormationNames* activeFormationNames );
|
||||
void setActiveFormationNamesAndUpdatePlots( RigFormationNames* activeFormationNames );
|
||||
RigFormationNames* activeFormationNames();
|
||||
void setActiveFormationNames( RigFormationNames* activeFormationNames );
|
||||
void setActiveFormationNamesAndUpdatePlots( RigFormationNames* activeFormationNames );
|
||||
RigFormationNames* activeFormationNames();
|
||||
RigAllenDiagramData* allenDiagramData();
|
||||
|
||||
void setSimWellData( const cvf::Collection<RigSimWellData>& data );
|
||||
const cvf::Collection<RigSimWellData>& wellResults() const
|
||||
|
||||
Reference in New Issue
Block a user