mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#9104 Thermal Fracture: Handle offset and scaling.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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() );
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user