mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge pull request #7960 from OPM/geomech_WIA4
GeoMech: Well Integrity Analysis
This commit is contained in:
@@ -59,6 +59,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivPolylinePartMgr.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivCellFilterPartMgr.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivDrawableSpheres.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivBoxGeometryGenerator.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -117,6 +118,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivPolylinePartMgr.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivCellFilterPartMgr.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivDrawableSpheres.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivBoxGeometryGenerator.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
@@ -0,0 +1,107 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2021- Equinor 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 "RivBoxGeometryGenerator.h"
|
||||
|
||||
#include "cafEffectGenerator.h"
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfPart.h"
|
||||
#include "cvfPrimitiveSetDirect.h"
|
||||
#include "cvfPrimitiveSetIndexedUInt.h"
|
||||
#include "cvfStructGridGeometryGenerator.h"
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::Part> RivBoxGeometryGenerator::createBoxFromVertices( const std::vector<cvf::Vec3f>& vertices,
|
||||
const cvf::Color3f color )
|
||||
{
|
||||
std::vector<cvf::Vec3f> boxVertices;
|
||||
|
||||
for ( int enumInt = cvf::StructGridInterface::POS_I; enumInt < cvf::StructGridInterface::NO_FACE; enumInt++ )
|
||||
{
|
||||
cvf::StructGridInterface::FaceType face = static_cast<cvf::StructGridInterface::FaceType>( enumInt );
|
||||
|
||||
cvf::ubyte faceConn[4];
|
||||
cvf::StructGridInterface::cellFaceVertexIndices( face, faceConn );
|
||||
|
||||
for ( int n = 0; n < 4; n++ )
|
||||
{
|
||||
boxVertices.push_back( cvf::Vec3f( vertices[faceConn[n]] ) );
|
||||
}
|
||||
}
|
||||
|
||||
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
|
||||
|
||||
cvf::ref<cvf::Vec3fArray> cvfVertices = new cvf::Vec3fArray;
|
||||
cvfVertices->assign( boxVertices );
|
||||
|
||||
if ( !( cvfVertices.notNull() && cvfVertices->size() != 0 ) ) return nullptr;
|
||||
|
||||
geo->setVertexArray( cvfVertices.p() );
|
||||
|
||||
cvf::ref<cvf::UIntArray> indices = lineIndicesFromQuadVertexArray( cvfVertices.p() );
|
||||
|
||||
cvf::ref<cvf::PrimitiveSetIndexedUInt> prim = new cvf::PrimitiveSetIndexedUInt( cvf::PT_LINES );
|
||||
prim->setIndices( indices.p() );
|
||||
|
||||
geo->addPrimitiveSet( prim.p() );
|
||||
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setName( cvf::String( "RivBoxGeometryGenerator::createBoxFromVertices" ) );
|
||||
|
||||
part->setDrawable( geo.p() );
|
||||
|
||||
cvf::ref<cvf::Effect> eff;
|
||||
caf::MeshEffectGenerator effGen( color );
|
||||
eff = effGen.generateUnCachedEffect();
|
||||
part->setEffect( eff.p() );
|
||||
|
||||
return part;
|
||||
}
|
||||
|
||||
cvf::ref<cvf::UIntArray> RivBoxGeometryGenerator::lineIndicesFromQuadVertexArray( const cvf::Vec3fArray* vertexArray )
|
||||
{
|
||||
// TODO - see issue #7890
|
||||
|
||||
CVF_ASSERT( vertexArray );
|
||||
|
||||
size_t numVertices = vertexArray->size();
|
||||
int numQuads = static_cast<int>( numVertices / 4 );
|
||||
CVF_ASSERT( numVertices % 4 == 0 );
|
||||
|
||||
cvf::ref<cvf::UIntArray> indices = new cvf::UIntArray;
|
||||
indices->resize( numQuads * 8 );
|
||||
|
||||
#pragma omp parallel for
|
||||
for ( int i = 0; i < numQuads; i++ )
|
||||
{
|
||||
int idx = 8 * i;
|
||||
indices->set( idx + 0, i * 4 + 0 );
|
||||
indices->set( idx + 1, i * 4 + 1 );
|
||||
indices->set( idx + 2, i * 4 + 1 );
|
||||
indices->set( idx + 3, i * 4 + 2 );
|
||||
indices->set( idx + 4, i * 4 + 2 );
|
||||
indices->set( idx + 5, i * 4 + 3 );
|
||||
indices->set( idx + 6, i * 4 + 3 );
|
||||
indices->set( idx + 7, i * 4 + 0 );
|
||||
}
|
||||
|
||||
return indices;
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2021- Equinor 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 <cvfArray.h>
|
||||
#include <cvfColor3.h>
|
||||
#include <cvfVector3.h>
|
||||
#include <vector>
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class Part;
|
||||
} // namespace cvf
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RivBoxGeometryGenerator
|
||||
{
|
||||
public:
|
||||
static cvf::ref<cvf::Part> createBoxFromVertices( const std::vector<cvf::Vec3f>& vertices, const cvf::Color3f color );
|
||||
|
||||
static cvf::ref<cvf::UIntArray> lineIndicesFromQuadVertexArray( const cvf::Vec3fArray* vertexArray );
|
||||
|
||||
private:
|
||||
RivBoxGeometryGenerator(){};
|
||||
};
|
@@ -37,6 +37,8 @@
|
||||
#include "RimPerforationInterval.h"
|
||||
#include "RimRegularLegendConfig.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimWellIASettings.h"
|
||||
#include "RimWellIASettingsCollection.h"
|
||||
#include "RimWellMeasurement.h"
|
||||
#include "RimWellMeasurementCollection.h"
|
||||
#include "RimWellMeasurementFilter.h"
|
||||
@@ -53,6 +55,7 @@
|
||||
#include "RimWellPathValve.h"
|
||||
|
||||
#include "Riv3dWellLogPlanePartMgr.h"
|
||||
#include "RivBoxGeometryGenerator.h"
|
||||
#include "RivDrawableSpheres.h"
|
||||
#include "RivFishbonesSubsPartMgr.h"
|
||||
#include "RivObjectSourceInfo.h"
|
||||
@@ -868,6 +871,7 @@ void RivWellPathPartMgr::appendStaticGeometryPartsToModel( cvf::ModelBasicList*
|
||||
|
||||
appendFishboneSubsPartsToModel( model, displayCoordTransform, characteristicCellSize );
|
||||
appendWellPathAttributesToModel( model, displayCoordTransform, characteristicCellSize );
|
||||
appendWellIntegrityIntervalsToModel( model, displayCoordTransform, characteristicCellSize );
|
||||
|
||||
RimGridView* gridView = dynamic_cast<RimGridView*>( m_rimView.p() );
|
||||
if ( gridView )
|
||||
@@ -1021,3 +1025,76 @@ double RivWellPathPartMgr::wellMeasurementRadius( double
|
||||
return wellPathCollection->wellPathRadiusScaleFactor() * wellMeasurementInView->radiusScaleFactor() *
|
||||
characteristicCellSize;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivWellPathPartMgr::appendWellIntegrityIntervalsToModel( cvf::ModelBasicList* model,
|
||||
const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
double characteristicCellSize )
|
||||
{
|
||||
if ( !m_rimWellPath ) return;
|
||||
|
||||
RimWellPathCollection* wellPathCollection = this->wellPathCollection();
|
||||
if ( !wellPathCollection ) return;
|
||||
|
||||
RigWellPath* wellPathGeometry = m_rimWellPath->wellPathGeometry();
|
||||
if ( !wellPathGeometry ) return;
|
||||
|
||||
// Since we're using the index of measured depths to find the index of a point, ensure they're equal
|
||||
CVF_ASSERT( wellPathGeometry->measuredDepths().size() == wellPathGeometry->wellPathPoints().size() );
|
||||
|
||||
double wellPathRadius = this->wellPathRadius( characteristicCellSize, wellPathCollection );
|
||||
double wiaIntervalRadius = wellPathRadius * 1.15;
|
||||
|
||||
RivPipeGeometryGenerator geoGenerator;
|
||||
|
||||
for ( auto wiaModel : m_rimWellPath->wellIASettingsCollection()->settings() )
|
||||
{
|
||||
if ( !wiaModel->isChecked() ) continue;
|
||||
if ( wiaModel->startMD() > wiaModel->endMD() ) continue;
|
||||
|
||||
double horizontalLengthAlongWellPath = 0.0;
|
||||
std::vector<cvf::Vec3d> intervalCL;
|
||||
{
|
||||
std::pair<std::vector<cvf::Vec3d>, std::vector<double>> intervalCoordsAndMD =
|
||||
wellPathGeometry->clippedPointSubset( wiaModel->startMD(), wiaModel->endMD(), &horizontalLengthAlongWellPath );
|
||||
intervalCL = intervalCoordsAndMD.first;
|
||||
}
|
||||
|
||||
if ( intervalCL.size() < 2 ) continue;
|
||||
|
||||
std::vector<cvf::Vec3d> intervalCLDisplayCS;
|
||||
|
||||
for ( cvf::Vec3d& point : intervalCL )
|
||||
{
|
||||
intervalCLDisplayCS.push_back( displayCoordTransform->transformToDisplayCoord( point ) );
|
||||
}
|
||||
cvf::ref<RivObjectSourceInfo> objectSourceInfo = new RivObjectSourceInfo( wiaModel );
|
||||
|
||||
cvf::Collection<cvf::Part> parts;
|
||||
geoGenerator.cylinderWithCenterLineParts( &parts, intervalCLDisplayCS, cvf::Color3f::ORCHID, wiaIntervalRadius );
|
||||
for ( auto& part : parts )
|
||||
{
|
||||
part->setSourceInfo( objectSourceInfo.p() );
|
||||
model->addPart( part.p() );
|
||||
}
|
||||
|
||||
if ( wiaModel->showBox() )
|
||||
{
|
||||
const auto& vertices = wiaModel->modelBoxVertices();
|
||||
|
||||
std::vector<cvf::Vec3f> transformedVertices;
|
||||
|
||||
for ( auto& v : vertices )
|
||||
{
|
||||
transformedVertices.push_back( cvf::Vec3f( displayCoordTransform->transformToDisplayCoord( v ) ) );
|
||||
}
|
||||
|
||||
cvf::ref<cvf::Part> boxpart =
|
||||
RivBoxGeometryGenerator::createBoxFromVertices( transformedVertices, cvf::Color3f::ORCHID );
|
||||
boxpart->setSourceInfo( objectSourceInfo.p() );
|
||||
model->addPart( boxpart.p() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -98,7 +98,6 @@ private:
|
||||
const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
double characteristicCellSize );
|
||||
|
||||
|
||||
void appendPerforationsToModel( cvf::ModelBasicList* model,
|
||||
size_t timeStepIndex,
|
||||
const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
@@ -116,6 +115,10 @@ private:
|
||||
const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
double characteristicCellSize );
|
||||
|
||||
void appendWellIntegrityIntervalsToModel( cvf::ModelBasicList* model,
|
||||
const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
double characteristicCellSize );
|
||||
|
||||
void buildWellPathParts( const caf::DisplayCoordTransform* displayCoordTransform,
|
||||
double characteristicCellSize,
|
||||
const cvf::BoundingBox& wellPathClipBoundingBox,
|
||||
|
Reference in New Issue
Block a user