Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate model based on an origin in the fault to improve calculation accuracy #11267

Merged
merged 3 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,20 @@ std::pair<size_t, size_t> RigFaultReactivationModelGenerator::findCellWithInters
return { i, j };
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::array<cvf::Vec3d, 12> RigFaultReactivationModelGenerator::shiftOrigin( const std::array<cvf::Vec3d, 12>& points,
const cvf::Vec3d& newOrigin )
{
std::array<cvf::Vec3d, 12> retPoints;
for ( int i = 0; i < (int)points.size(); i++ )
{
retPoints[i] = points[i] - newOrigin;
}
return retPoints;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -574,19 +588,30 @@ void RigFaultReactivationModelGenerator::generateGeometry( size_t sta

generatePointsFrontBack();

// use temp origin in start position, at zero depth
cvf::Vec3d origin( m_startPosition );
origin.z() = 0.0;

cvf::Vec3d tVec = m_modelThickness * m_modelNormal;
std::vector<cvf::Vec3d> thicknessVectors;
std::vector<caf::Line<double>> faultLines;
const std::vector<double> thicknessFactors = { -1.0, 0.0, 1.0 };

for ( int i = 0; i < 3; i++ )
{
faultLines.push_back( caf::Line<double>( m_topFault + thicknessFactors[i] * tVec, m_bottomFault + thicknessFactors[i] * tVec ) );
faultLines.push_back(
caf::Line<double>( m_topFault - origin + thicknessFactors[i] * tVec, m_bottomFault - origin + thicknessFactors[i] * tVec ) );
thicknessVectors.push_back( thicknessFactors[i] * tVec );
}

frontPart->generateGeometry( m_frontPoints,
frontReservoirLayers,
std::array<cvf::Vec3d, 12> shiftedFrontPoints = shiftOrigin( m_frontPoints, origin );
std::array<cvf::Vec3d, 12> shiftedBackPoints = shiftOrigin( m_backPoints, origin );

std::vector<double> frontResZ = extractZValues( frontReservoirLayers );
std::vector<double> backResZ = extractZValues( backReservoirLayers );

frontPart->generateGeometry( shiftedFrontPoints,
frontResZ,
m_maxCellHeight,
m_cellSizeHeightFactor,
m_horizontalPartition,
Expand All @@ -598,8 +623,8 @@ void RigFaultReactivationModelGenerator::generateGeometry( size_t sta
std::reverse( faultLines.begin(), faultLines.end() );
std::reverse( thicknessVectors.begin(), thicknessVectors.end() );

backPart->generateGeometry( m_backPoints,
backReservoirLayers,
backPart->generateGeometry( shiftedBackPoints,
backResZ,
m_maxCellHeight,
m_cellSizeHeightFactor,
m_horizontalPartition,
Expand All @@ -608,6 +633,9 @@ void RigFaultReactivationModelGenerator::generateGeometry( size_t sta
m_topReservoirBack.z(),
m_faultZoneCells );

frontPart->shiftNodes( origin );
backPart->shiftNodes( origin );

frontPart->generateLocalNodes( m_localCoordTransform );
backPart->generateLocalNodes( m_localCoordTransform );

Expand Down Expand Up @@ -792,3 +820,18 @@ std::pair<double, double> RigFaultReactivationModelGenerator::depthTopBottom() c
{
return { -m_startDepth, m_bottomDepth };
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RigFaultReactivationModelGenerator::extractZValues( const std::vector<cvf::Vec3d>& points )
{
std::vector<double> layers;

for ( auto& p : points )
{
layers.push_back( p.z() );
}

return layers;
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@ class RigFaultReactivationModelGenerator : cvf::Object
static const std::vector<double> partition( double distance, double startSize, double sizeFactor );
static std::pair<FaceType, FaceType> sideFacesIJ( FaceType face );

static cvf::Vec3d extrapolatePoint( cvf::Vec3d startPoint, cvf::Vec3d endPoint, double stopDepth );
static void splitLargeLayers( std::map<double, cvf::Vec3d>& layers, double maxHeight );
static void mergeTinyLayers( std::map<double, cvf::Vec3d>& layers, double minHeight );
static cvf::Vec3d extrapolatePoint( cvf::Vec3d startPoint, cvf::Vec3d endPoint, double stopDepth );
static void splitLargeLayers( std::map<double, cvf::Vec3d>& layers, double maxHeight );
static void mergeTinyLayers( std::map<double, cvf::Vec3d>& layers, double minHeight );
static std::vector<double> extractZValues( const std::vector<cvf::Vec3d>& points );
static std::array<cvf::Vec3d, 12> shiftOrigin( const std::array<cvf::Vec3d, 12>& points, const cvf::Vec3d& newOrigin );

std::vector<size_t> buildCellColumn( size_t startCell, FaceType startFace, std::map<double, cvf::Vec3d>& layers );

Expand Down
58 changes: 29 additions & 29 deletions ApplicationLibCode/ReservoirDataModel/RigGriddedPart3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,21 +165,6 @@ std::vector<double> RigGriddedPart3d::generateGrowingLayers( double zFrom, doubl
return layers;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RigGriddedPart3d::extractZValues( const std::vector<cvf::Vec3d>& points )
{
std::vector<double> layers;

for ( auto& p : points )
{
layers.push_back( p.z() );
}

return layers;
}

//--------------------------------------------------------------------------------------------------
/// Point index in input
///
Expand All @@ -203,7 +188,7 @@ std::vector<double> RigGriddedPart3d::extractZValues( const std::vector<cvf::Vec
///
//--------------------------------------------------------------------------------------------------
void RigGriddedPart3d::generateGeometry( const std::array<cvf::Vec3d, 12>& inputPoints,
const std::vector<cvf::Vec3d>& reservoirLayers,
const std::vector<double>& reservoirZ,
double maxCellHeight,
double cellSizeFactor,
const std::vector<double>& horizontalPartition,
Expand All @@ -220,8 +205,9 @@ void RigGriddedPart3d::generateGeometry( const std::array<cvf::Vec3d, 12>& in

layersPerRegion[Regions::LowerUnderburden] = generateGrowingLayers( inputPoints[1].z(), inputPoints[0].z(), maxCellHeight, cellSizeFactor );
layersPerRegion[Regions::UpperUnderburden] = generateConstantLayers( inputPoints[1].z(), inputPoints[2].z(), maxCellHeight );
layersPerRegion[Regions::Reservoir] = extractZValues( reservoirLayers );
layersPerRegion[Regions::LowerOverburden] = generateConstantLayers( inputPoints[3].z(), inputPoints[4].z(), maxCellHeight );
layersPerRegion[Regions::Reservoir] = reservoirZ;

layersPerRegion[Regions::LowerOverburden] = generateConstantLayers( inputPoints[3].z(), inputPoints[4].z(), maxCellHeight );
layersPerRegion[Regions::UpperOverburden] = generateGrowingLayers( inputPoints[4].z(), inputPoints[5].z(), maxCellHeight, cellSizeFactor );

layersPerRegion[Regions::LowerUnderburden].pop_back(); // to avoid overlap with bottom of next region
Expand Down Expand Up @@ -304,8 +290,10 @@ void RigGriddedPart3d::generateGeometry( const std::array<cvf::Vec3d, 12>& in
}
else if ( region == Regions::Reservoir )
{
toPos = reservoirLayers[v];
fromPos.z() = toPos.z();
fromPos.z() = reservoirZ[v];
cvf::Plane zPlane;
zPlane.setFromPointAndNormal( fromPos, cvf::Vec3d::Z_AXIS );
zPlane.intersect( faultLines[1].start(), faultLines[1].end(), &toPos );
}

cvf::Vec3d stepHorz = toPos - fromPos;
Expand All @@ -318,14 +306,7 @@ void RigGriddedPart3d::generateGeometry( const std::array<cvf::Vec3d, 12>& in

for ( int h = 0; h <= (int)nHorzCells; h++ )
{
if ( h == (int)nHorzCells )
{
p = toPos;
}
else
{
p = toPos - horizontalPartition[h] * stepHorz;
}
p = toPos - horizontalPartition[h] * stepHorz;

for ( int t = 0; t <= nThicknessCells; t++, nodeIndex++ )
{
Expand All @@ -336,7 +317,7 @@ void RigGriddedPart3d::generateGeometry( const std::array<cvf::Vec3d, 12>& in
( ( region == Regions::Reservoir ) || region == Regions::LowerOverburden || region == Regions::UpperUnderburden ) )
{
cvf::Plane zPlane;
zPlane.setFromPointAndNormal( nodePoint, cvf::Vec3d::Z_AXIS );
zPlane.setFromPointAndNormal( p, cvf::Vec3d::Z_AXIS );
zPlane.intersect( faultLines[t].start(), faultLines[t].end(), &nodePoint );
}

Expand Down Expand Up @@ -687,6 +668,25 @@ void RigGriddedPart3d::generateLocalNodes( const cvf::Mat4d transform )
}
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigGriddedPart3d::shiftNodes( const cvf::Vec3d offset )
{
for ( int i = 0; i < (int)m_nodes.size(); i++ )
{
m_nodes[i] += offset;
}

for ( int i = 0; i < (int)m_meshLines.size(); i++ )
{
for ( int j = 0; j < (int)m_meshLines[i].size(); j++ )
{
m_meshLines[i][j] += offset;
}
}
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions ApplicationLibCode/ReservoirDataModel/RigGriddedPart3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class RigGriddedPart3d : public cvf::Object
void reset();

void generateGeometry( const std::array<cvf::Vec3d, 12>& inputPoints,
const std::vector<cvf::Vec3d>& reservoirLayers,
const std::vector<double>& reservoirZ,
double maxCellHeight,
double cellSizeFactor,
const std::vector<double>& horizontalPartition,
Expand All @@ -59,6 +59,7 @@ class RigGriddedPart3d : public cvf::Object
double topHeight,
int nFaultZoneCells );

void shiftNodes( const cvf::Vec3d offset );
void generateLocalNodes( const cvf::Mat4d transform );
void setUseLocalCoordinates( bool useLocalCoordinates );

Expand Down Expand Up @@ -89,7 +90,6 @@ class RigGriddedPart3d : public cvf::Object
static cvf::Vec3d stepVector( cvf::Vec3d start, cvf::Vec3d stop, int nSteps );
static std::vector<double> generateConstantLayers( double zFrom, double zTo, double maxSize );
static std::vector<double> generateGrowingLayers( double zFrom, double zTo, double maxSize, double growfactor );
static std::vector<double> extractZValues( const std::vector<cvf::Vec3d>& points );

void generateVerticalMeshlines( const std::vector<cvf::Vec3d>& cornerPoints, const std::vector<double>& horzPartition );

Expand Down
Loading