#9104 Thermal Fracture: Handle offset and scaling.

This commit is contained in:
Kristian Bendiksen
2022-08-05 15:20:54 +02:00
parent 1093b844b0
commit f82c530966
5 changed files with 173 additions and 73 deletions

View File

@@ -97,15 +97,6 @@ void RimThermalFractureTemplate::setDefaultsBasedOnFile()
else
RiaLogging::info( QString( "Property for polygon calculation not set." ) );
// if ( m_fractureDefinitionData->orientation() == RigStimPlanFractureDefinition::Orientation::TRANSVERSE )
// {
// m_orientationType = TRANSVERSE_WELL_PATH;
// }
// else if ( m_fractureDefinitionData->orientation() == RigStimPlanFractureDefinition::Orientation::LONGITUDINAL )
// {
// m_orientationType = ALONG_WELL_PATH;
// }
QStringList resultNames = conductivityResultNames();
if ( !resultNames.isEmpty() )
{
@@ -216,22 +207,11 @@ QStringList RimThermalFractureTemplate::conductivityResultNames() const
//--------------------------------------------------------------------------------------------------
void RimThermalFractureTemplate::computeDepthOfWellPathAtFracture()
{
// if ( !m_fractureDefinitionData.isNull() )
// {
// double firstTvd = m_fractureDefinitionData->topPerfTvd();
// double lastTvd = m_fractureDefinitionData->bottomPerfTvd();
// if ( firstTvd != HUGE_VAL && lastTvd != HUGE_VAL )
// {
// m_wellPathDepthAtFracture.setValueWithFieldChanged( ( firstTvd + lastTvd ) / 2 );
// }
// else
// {
// firstTvd = m_fractureDefinitionData->minDepth();
// lastTvd = m_fractureDefinitionData->maxDepth();
// m_wellPathDepthAtFracture.setValueWithFieldChanged( ( firstTvd + lastTvd ) / 2 );
// }
// }
if ( m_fractureDefinitionData )
{
double z = m_fractureDefinitionData->centerPosition().z();
m_wellPathDepthAtFracture.setValueWithFieldChanged( z );
}
}
//--------------------------------------------------------------------------------------------------
@@ -239,26 +219,27 @@ void RimThermalFractureTemplate::computeDepthOfWellPathAtFracture()
//--------------------------------------------------------------------------------------------------
void RimThermalFractureTemplate::computePerforationLength()
{
// if ( !m_fractureDefinitionData.isNull() )
// {
// double firstTvd = m_fractureDefinitionData->topPerfTvd();
// double lastTvd = m_fractureDefinitionData->bottomPerfTvd();
if ( m_fractureDefinitionData )
{
auto [firstTvd, lastTvd] =
RigThermalFractureResultUtil::minMaxDepth( m_fractureDefinitionData, m_activeTimeStepIndex );
// if ( firstTvd != HUGE_VAL && lastTvd != HUGE_VAL )
// {
// m_perforationLength = cvf::Math::abs( firstTvd - lastTvd );
// }
// }
if ( firstTvd != HUGE_VAL && lastTvd != HUGE_VAL )
{
m_perforationLength = cvf::Math::abs( firstTvd - lastTvd );
}
}
// if ( fractureTemplateUnit() == RiaDefines::EclipseUnitSystem::UNITS_METRIC && m_perforationLength < 10 )
// {
// m_perforationLength = 10;
// }
// else if ( fractureTemplateUnit() == RiaDefines::EclipseUnitSystem::UNITS_FIELD &&
// m_perforationLength < RiaEclipseUnitTools::meterToFeet( 10 ) )
// {
// m_perforationLength = std::round( RiaEclipseUnitTools::meterToFeet( 10 ) );
// }
double minPerforationLength = 10.0;
if ( fractureTemplateUnit() == RiaDefines::EclipseUnitSystem::UNITS_METRIC && m_perforationLength < minPerforationLength )
{
m_perforationLength = minPerforationLength;
}
else if ( fractureTemplateUnit() == RiaDefines::EclipseUnitSystem::UNITS_FIELD &&
m_perforationLength < RiaEclipseUnitTools::meterToFeet( minPerforationLength ) )
{
m_perforationLength = std::round( RiaEclipseUnitTools::meterToFeet( minPerforationLength ) );
}
}
//--------------------------------------------------------------------------------------------------
@@ -664,21 +645,6 @@ void RimThermalFractureTemplate::fractureTriangleGeometry( std::vector<cvf::Vec3
}
}
// //--------------------------------------------------------------------------------------------------
// ///
// //--------------------------------------------------------------------------------------------------
// void RimThermalFractureTemplate::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
// {
// RimMeshFractureTemplate::defineUiOrdering( uiConfigName, uiOrdering );
// uiOrdering.add( &m_propertiesTable );
// // if ( widthResultValues().empty() )
// // {
// // m_fractureWidthType = USER_DEFINED_WIDTH;
// // }
// }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -692,11 +658,9 @@ QString RimThermalFractureTemplate::getFileSelectionFilter() const
//--------------------------------------------------------------------------------------------------
std::pair<double, double> RimThermalFractureTemplate::wellPathDepthAtFractureRange() const
{
// if ( !m_fractureDefinitionData ) return std::make_pair( 0.0, 1.0 );
if ( !m_fractureDefinitionData ) return std::make_pair( 0.0, 1.0 );
// return std::make_pair( m_fractureDefinitionData->minDepth(), m_fractureDefinitionData->maxDepth() );
return std::make_pair( 0.0, 1.0 );
return RigThermalFractureResultUtil::minMaxDepth( m_fractureDefinitionData, m_activeTimeStepIndex );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -185,3 +185,69 @@ std::vector<cvf::Vec3d> RigThermalFractureDefinition::relativeCoordinates( int t
return relCoords;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RigThermalFractureDefinition::centerPosition() const
{
int xIndex = getPropertyIndex( "XCoord" );
int yIndex = getPropertyIndex( "YCoord" );
int zIndex = getPropertyIndex( "ZCoord" );
if ( xIndex == -1 || yIndex == -1 || zIndex == -1 )
{
return cvf::Vec3d::UNDEFINED;
}
// The first node is the center node
int centerNodeIndex = 0;
int timeStepIndex = 0;
cvf::Vec3d centerNode( getPropertyValue( xIndex, centerNodeIndex, timeStepIndex ),
getPropertyValue( yIndex, centerNodeIndex, timeStepIndex ),
getPropertyValue( zIndex, centerNodeIndex, timeStepIndex ) );
return centerNode;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::BoundingBox RigThermalFractureDefinition::getBoundingBox( int timeStepIndex ) const
{
std::vector<cvf::Vec3d> coords;
cvf::BoundingBox bb;
int xIndex = getPropertyIndex( "XCoord" );
int yIndex = getPropertyIndex( "YCoord" );
int zIndex = getPropertyIndex( "ZCoord" );
if ( xIndex == -1 || yIndex == -1 || zIndex == -1 )
{
return bb;
}
for ( size_t nodeIndex = 0; nodeIndex < numNodes(); nodeIndex++ )
{
cvf::Vec3d nodePos( getPropertyValue( xIndex, static_cast<int>( nodeIndex ), timeStepIndex ),
getPropertyValue( yIndex, static_cast<int>( nodeIndex ), timeStepIndex ),
getPropertyValue( zIndex, static_cast<int>( nodeIndex ), timeStepIndex ) );
bb.add( nodePos );
}
return bb;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigThermalFractureDefinition::minDepth( int timeStepIndex ) const
{
return getBoundingBox( timeStepIndex ).min().z();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigThermalFractureDefinition::maxDepth( int timeStepIndex ) const
{
return getBoundingBox( timeStepIndex ).max().z();
}

View File

@@ -22,6 +22,7 @@
#include "RigThermalFractureResult.h"
#include "cvfBoundingBox.h"
#include "cvfVector3.h"
#include <QString>
@@ -58,11 +59,18 @@ public:
std::vector<cvf::Vec3d> relativeCoordinates( int timeStepIndex ) const;
cvf::Vec3d centerPosition() const;
double minDepth( int timeStepIndex ) const;
double maxDepth( int timeStepIndex ) const;
void setUnitSystem( RiaDefines::EclipseUnitSystem unitSystem );
RiaDefines::EclipseUnitSystem unitSystem() const;
private:
cvf::BoundingBox getBoundingBox( int timeStepIndex ) const;
QString m_name;
RiaDefines::EclipseUnitSystem m_unitSystem;

View File

@@ -73,16 +73,8 @@ std::vector<std::vector<double>>
boundingBox.expand( 1.0 );
// Generate a uniform mesh
auto [xCoordsAtNodes, yCoordsAtNodes] = generateUniformMesh( boundingBox, numSamplesX, numSamplesY );
// Find center points
std::vector<double> xCoords;
for ( int i = 0; i < static_cast<int>( xCoordsAtNodes.size() ) - 1; i++ )
xCoords.push_back( ( xCoordsAtNodes[i] + xCoordsAtNodes[i + 1] ) / 2 );
std::vector<double> depthCoords;
for ( int i = 0; i < static_cast<int>( yCoordsAtNodes.size() ) - 1; i++ )
depthCoords.push_back( ( yCoordsAtNodes[i] + yCoordsAtNodes[i + 1] ) / 2 );
// Generate a uniform mesh (center points)
auto [xCoords, depthCoords] = generateUniformMesh( boundingBox, numSamplesX, numSamplesY );
// Fill with invalid value
for ( int i = 0; i < numSamplesY; i++ )
@@ -289,7 +281,18 @@ cvf::cref<RigFractureGrid>
boundingBox.expand( 1.0 );
// Generate a uniform mesh
auto [xCoordsAtNodes, yCoordsAtNodes] = generateUniformMesh( boundingBox, numSamplesX, numSamplesY );
auto [Xs, Ys] = generateUniformMesh( boundingBox, numSamplesX, numSamplesY );
double centerZ = fractureDefinition->centerPosition().z();
double offset = wellPathIntersectionAtFractureDepth - centerZ;
std::vector<double> adjustedYs = adjustedYCoordsAroundWellPathPosition( Ys, offset );
std::vector<double> scaledXs = scaleVector( Xs, xScaleFactor );
std::vector<double> scaledYs = scaleVector( adjustedYs, yScaleFactor );
std::vector<double> xCoordsAtNodes = scaledXs;
std::vector<double> yCoordsAtNodes = scaledYs;
// Find center points
std::vector<double> xCoords;
@@ -396,6 +399,36 @@ double RigThermalFractureResultUtil::linearSampling( double minVal
return sampleDistance;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RigThermalFractureResultUtil::scaleVector( const std::vector<double>& xs, double scaleFactor )
{
std::vector<double> scaledXs;
// Scale using 0 as scaling anchor
for ( double x : xs )
{
if ( scaleFactor != 1.0 ) x *= scaleFactor;
scaledXs.push_back( x );
}
return scaledXs;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RigThermalFractureResultUtil::adjustedYCoordsAroundWellPathPosition( const std::vector<double>& ys,
double offset )
{
std::vector<double> adjusted;
for ( auto p : ys )
adjusted.push_back( p + offset );
return adjusted;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -500,3 +533,25 @@ double RigThermalFractureResultUtil::interpolateProperty( const cvf::Vec3d&
return calc.weightedMean();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::pair<double, double>
RigThermalFractureResultUtil::minMaxDepth( std::shared_ptr<const RigThermalFractureDefinition> fractureDefinition,
int activeTimeStepIndex )
{
auto getBoundingBox = []( const std::vector<cvf::Vec3d>& coords ) {
cvf::BoundingBox bb;
for ( auto c : coords )
bb.add( c );
return bb;
};
auto relativeCoords = getRelativeCoordinates( fractureDefinition, activeTimeStepIndex );
auto bb = getBoundingBox( relativeCoords );
double centerZ = fractureDefinition->centerPosition().z();
// Y is depth in fracture coordinate system.
return std::make_pair( centerZ + bb.min().y(), centerZ + bb.max().y() );
}

View File

@@ -83,6 +83,9 @@ public:
MinMaxAccumulator& minMaxAccumulator,
PosNegAccumulator& posNegAccumulator );
static std::pair<double, double> minMaxDepth( std::shared_ptr<const RigThermalFractureDefinition> fractureDefinition,
int activeTimeStepIndex );
private:
static std::pair<std::vector<double>, std::vector<double>>
generateUniformMesh( const cvf::BoundingBox& bb, int numSamplesX, int numSamplesY );
@@ -95,6 +98,10 @@ private:
getRelativeCoordinates( std::shared_ptr<const RigThermalFractureDefinition> fractureDefinition,
size_t timeStepIndex );
static std::vector<double> scaleVector( const std::vector<double>& xs, double scaleFactor );
static std::vector<double> adjustedYCoordsAroundWellPathPosition( const std::vector<double>& ys, double offset );
static double interpolateProperty( const cvf::Vec3d& position,
const std::vector<cvf::Vec3d>& points,
std::shared_ptr<const RigThermalFractureDefinition> fractureDefinition,