mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#9858 Compute distance to closest fault for each cell (FAULTDIST).
This commit is contained in:
parent
d4f11e0f8f
commit
eb88cca7e8
@ -361,6 +361,14 @@ QString RiaResultNames::indexKResultName()
|
|||||||
return "INDEX_K";
|
return "INDEX_K";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RiaResultNames::faultDistanceName()
|
||||||
|
{
|
||||||
|
return "FAULTDIST";
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -70,6 +70,8 @@ QString indexIResultName();
|
|||||||
QString indexJResultName();
|
QString indexJResultName();
|
||||||
QString indexKResultName();
|
QString indexKResultName();
|
||||||
|
|
||||||
|
QString faultDistanceName();
|
||||||
|
|
||||||
QString soil();
|
QString soil();
|
||||||
QString sgas();
|
QString sgas();
|
||||||
QString swat();
|
QString swat();
|
||||||
|
@ -1038,12 +1038,17 @@ void RigCaseCellResultsData::createPlaceholderResultEntries()
|
|||||||
{
|
{
|
||||||
findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::indexIResultName() ),
|
findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::indexIResultName() ),
|
||||||
false );
|
false );
|
||||||
|
|
||||||
findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::indexJResultName() ),
|
findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::indexJResultName() ),
|
||||||
false );
|
false );
|
||||||
findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::indexKResultName() ),
|
findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::indexKResultName() ),
|
||||||
false );
|
false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fault distance
|
||||||
|
{
|
||||||
|
findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::faultDistanceName() ),
|
||||||
|
false );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1254,6 +1259,10 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResult( const RigEclipseResu
|
|||||||
{
|
{
|
||||||
computeIndexResults();
|
computeIndexResults();
|
||||||
}
|
}
|
||||||
|
else if ( resultName == RiaResultNames::faultDistanceName() )
|
||||||
|
{
|
||||||
|
computeFaultDistance();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ( type == RiaDefines::ResultCatType::DYNAMIC_NATIVE )
|
else if ( type == RiaDefines::ResultCatType::DYNAMIC_NATIVE )
|
||||||
{
|
{
|
||||||
@ -2002,6 +2011,72 @@ void RigCaseCellResultsData::computeIndexResults()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RigCaseCellResultsData::computeFaultDistance()
|
||||||
|
{
|
||||||
|
size_t reservoirCellCount = activeCellInfo()->reservoirCellCount();
|
||||||
|
if ( reservoirCellCount == 0 ) return;
|
||||||
|
|
||||||
|
size_t resultIndex = findScalarResultIndexFromAddress(
|
||||||
|
RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::faultDistanceName() ) );
|
||||||
|
|
||||||
|
if ( resultIndex == cvf::UNDEFINED_SIZE_T ) return;
|
||||||
|
|
||||||
|
std::vector<std::vector<double>>& result = m_cellScalarResults[resultIndex];
|
||||||
|
|
||||||
|
if ( result.empty() ) result.resize( 1 );
|
||||||
|
|
||||||
|
bool shouldCompute = false;
|
||||||
|
if ( result[0].size() < reservoirCellCount )
|
||||||
|
{
|
||||||
|
result[0].resize( reservoirCellCount, std::numeric_limits<double>::infinity() );
|
||||||
|
shouldCompute = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !shouldCompute ) return;
|
||||||
|
|
||||||
|
const std::vector<RigCell>& globalCellArray = m_ownerMainGrid->globalCellArray();
|
||||||
|
|
||||||
|
long long numCells = static_cast<long long>( globalCellArray.size() );
|
||||||
|
|
||||||
|
std::vector<cvf::StructGridInterface::FaceType> faceTypes = cvf::StructGridInterface::validFaceTypes();
|
||||||
|
|
||||||
|
// Preprocessing: create vector of all fault face centers.
|
||||||
|
std::vector<cvf::Vec3d> faultFaceCenters;
|
||||||
|
for ( long long cellIdx = 0; cellIdx < numCells; cellIdx++ )
|
||||||
|
{
|
||||||
|
if ( activeCellInfo()->isActive( cellIdx ) )
|
||||||
|
{
|
||||||
|
const RigCell& cell = globalCellArray[cellIdx];
|
||||||
|
for ( auto faceType : faceTypes )
|
||||||
|
{
|
||||||
|
if ( m_ownerMainGrid->findFaultFromCellIndexAndCellFace( cellIdx, faceType ) )
|
||||||
|
faultFaceCenters.push_back( cell.faceCenter( faceType ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma omp parallel for
|
||||||
|
for ( long long cellIdx = 0; cellIdx < numCells; cellIdx++ )
|
||||||
|
{
|
||||||
|
const RigCell& cell = globalCellArray[cellIdx];
|
||||||
|
|
||||||
|
size_t resultIndex = cellIdx;
|
||||||
|
if ( resultIndex == cvf::UNDEFINED_SIZE_T || !activeCellInfo()->isActive( cellIdx ) ) continue;
|
||||||
|
|
||||||
|
// Find closest fault face
|
||||||
|
double shortestDistance = std::numeric_limits<double>::infinity();
|
||||||
|
for ( const cvf::Vec3d& faultFaceCenter : faultFaceCenters )
|
||||||
|
{
|
||||||
|
shortestDistance = std::min( cell.center().pointDistance( faultFaceCenter ), shortestDistance );
|
||||||
|
}
|
||||||
|
|
||||||
|
result[0][resultIndex] = shortestDistance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace RigTransmissibilityCalcTools
|
namespace RigTransmissibilityCalcTools
|
||||||
{
|
{
|
||||||
void calculateConnectionGeometry( const RigCell& c1,
|
void calculateConnectionGeometry( const RigCell& c1,
|
||||||
|
@ -187,6 +187,7 @@ private:
|
|||||||
void computeMobilePV();
|
void computeMobilePV();
|
||||||
|
|
||||||
void computeIndexResults();
|
void computeIndexResults();
|
||||||
|
void computeFaultDistance();
|
||||||
|
|
||||||
bool isDataPresent( size_t scalarResultIndex ) const;
|
bool isDataPresent( size_t scalarResultIndex ) const;
|
||||||
|
|
||||||
|
@ -233,6 +233,21 @@ StructGridInterface::FaceType StructGridInterface::oppositeFace( FaceType face )
|
|||||||
return opposite;
|
return opposite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::vector<StructGridInterface::FaceType> StructGridInterface::validFaceTypes()
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
cvf::StructGridInterface::FaceType::NEG_I,
|
||||||
|
cvf::StructGridInterface::FaceType::POS_I,
|
||||||
|
cvf::StructGridInterface::FaceType::NEG_J,
|
||||||
|
cvf::StructGridInterface::FaceType::POS_J,
|
||||||
|
cvf::StructGridInterface::FaceType::NEG_K,
|
||||||
|
cvf::StructGridInterface::FaceType::POS_K,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Return values are set to cvf::UNDEFINED_SIZE_T if the neighbor is in the negative area
|
/// Return values are set to cvf::UNDEFINED_SIZE_T if the neighbor is in the negative area
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -125,6 +125,7 @@ public:
|
|||||||
|
|
||||||
static std::pair<ubyte, ubyte> edgeVertexIndices( cvf::StructGridInterface::FaceType face1,
|
static std::pair<ubyte, ubyte> edgeVertexIndices( cvf::StructGridInterface::FaceType face1,
|
||||||
cvf::StructGridInterface::FaceType face2 );
|
cvf::StructGridInterface::FaceType face2 );
|
||||||
|
static std::vector<FaceType> validFaceTypes();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable double m_characteristicCellSizeI;
|
mutable double m_characteristicCellSizeI;
|
||||||
|
Loading…
Reference in New Issue
Block a user