2015-09-04 08:30:04 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) Statoil ASA
|
|
|
|
// Copyright (C) Ceetron Solutions AS
|
2019-09-05 05:24:45 -05:00
|
|
|
//
|
2015-09-04 08:30:04 -05:00
|
|
|
// 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.
|
2019-09-05 05:24:45 -05:00
|
|
|
//
|
2015-09-04 08:30:04 -05:00
|
|
|
// 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.
|
2019-09-05 05:24:45 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2015-09-04 08:30:04 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2019-11-06 03:07:56 -06:00
|
|
|
#include "RiaDefines.h"
|
|
|
|
#include "RigWbsParameter.h"
|
2015-10-14 01:08:13 -05:00
|
|
|
#include "RigWellLogExtractor.h"
|
|
|
|
|
2018-06-06 05:47:23 -05:00
|
|
|
#include "RigFemResultPosEnum.h"
|
|
|
|
|
2019-11-06 03:07:56 -06:00
|
|
|
#include "cafAppEnum.h"
|
2018-06-05 04:56:47 -05:00
|
|
|
#include "cafTensor3.h"
|
|
|
|
|
2019-09-05 05:24:45 -05:00
|
|
|
#include "cvfObject.h"
|
2018-06-05 04:56:47 -05:00
|
|
|
#include "cvfStructGrid.h"
|
2015-09-04 08:30:04 -05:00
|
|
|
#include "cvfVector3.h"
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
2018-08-07 05:38:48 -05:00
|
|
|
class RigFemPart;
|
2015-09-04 08:30:04 -05:00
|
|
|
class RigFemResultAddress;
|
2018-06-05 04:56:47 -05:00
|
|
|
class RigGeoMechCaseData;
|
|
|
|
class RigWellPath;
|
2015-09-04 08:30:04 -05:00
|
|
|
|
2019-09-05 05:24:45 -05:00
|
|
|
namespace cvf
|
|
|
|
{
|
|
|
|
class BoundingBox;
|
2015-09-04 08:30:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//==================================================================================================
|
2019-09-05 05:24:45 -05:00
|
|
|
///
|
2015-09-04 08:30:04 -05:00
|
|
|
//==================================================================================================
|
2015-10-14 01:08:13 -05:00
|
|
|
class RigGeoMechWellLogExtractor : public RigWellLogExtractor
|
2015-09-04 08:30:04 -05:00
|
|
|
{
|
|
|
|
public:
|
2020-02-10 05:39:16 -06:00
|
|
|
static const double PURE_WATER_DENSITY_GCM3;
|
|
|
|
static const double GRAVITY_ACCEL;
|
|
|
|
|
2019-11-06 03:07:56 -06:00
|
|
|
using WbsParameterSource = RigWbsParameter::Source;
|
|
|
|
using WbsParameterSourceEnum = RigWbsParameter::SourceEnum;
|
2019-09-05 05:24:45 -05:00
|
|
|
|
|
|
|
public:
|
2020-10-06 05:37:16 -05:00
|
|
|
RigGeoMechWellLogExtractor( gsl::not_null<RigGeoMechCaseData*> aCase,
|
2023-05-12 01:13:56 -05:00
|
|
|
int partId,
|
2020-10-06 05:37:16 -05:00
|
|
|
gsl::not_null<const RigWellPath*> wellpath,
|
2021-01-15 03:32:36 -06:00
|
|
|
const std::string& wellCaseErrorMsgName );
|
2019-09-05 05:24:45 -05:00
|
|
|
|
2023-01-18 07:42:33 -06:00
|
|
|
void performCurveDataSmoothing( int timeStepIndex,
|
|
|
|
int frameIndex,
|
2019-10-03 07:57:46 -05:00
|
|
|
std::vector<double>* mds,
|
|
|
|
std::vector<double>* tvds,
|
|
|
|
std::vector<double>* values,
|
|
|
|
const double smoothingTreshold );
|
2019-10-03 07:16:56 -05:00
|
|
|
|
2023-01-18 07:42:33 -06:00
|
|
|
QString curveData( const RigFemResultAddress& resAddr, int timeStepIndex, int frameIndex, std::vector<double>* values );
|
2019-09-05 05:24:45 -05:00
|
|
|
const RigGeoMechCaseData* caseData();
|
2015-09-04 08:30:04 -05:00
|
|
|
|
2019-11-06 03:07:56 -06:00
|
|
|
void setWbsLasValues( const RigWbsParameter& parameter, const std::vector<std::pair<double, double>>& values );
|
|
|
|
void setWbsParametersSource( RigWbsParameter parameter, WbsParameterSource source );
|
|
|
|
void setWbsUserDefinedValue( RigWbsParameter parameter, double userDefinedValue );
|
2018-09-03 04:24:35 -05:00
|
|
|
|
2020-01-29 05:52:07 -06:00
|
|
|
static QString parameterInputUnits( const RigWbsParameter& parameter );
|
|
|
|
|
2023-01-18 07:42:33 -06:00
|
|
|
std::vector<double> porePressureSourceRegions( int timeStepIndex, int frameIndex );
|
|
|
|
std::vector<double> poissonSourceRegions( int timeStepIndex, int frameIndex );
|
|
|
|
std::vector<double> ucsSourceRegions( int timeStepIndex, int frameIndex );
|
2019-09-25 04:59:31 -05:00
|
|
|
|
2023-02-26 03:48:40 -06:00
|
|
|
static caf::Ten3d transformTensorToWellPathOrientation( const cvf::Vec3d& wellPathTangent, const caf::Ten3d& wellPathTensor );
|
2020-07-06 03:42:21 -05:00
|
|
|
|
2023-02-26 03:48:40 -06:00
|
|
|
static double hydroStaticPorePressureAtDepth( double effectiveDepthMeters, double waterDensityGCM3 = PURE_WATER_DENSITY_GCM3 );
|
2020-08-11 07:31:51 -05:00
|
|
|
|
2021-01-15 03:32:36 -06:00
|
|
|
double waterDepth() const;
|
|
|
|
double estimateWaterDepth() const;
|
|
|
|
|
2023-05-12 01:13:56 -05:00
|
|
|
int partId() const;
|
|
|
|
bool valid() const;
|
|
|
|
|
2015-09-04 08:30:04 -05:00
|
|
|
private:
|
2018-08-24 01:52:54 -05:00
|
|
|
enum WellPathTangentCalculation
|
|
|
|
{
|
|
|
|
TangentFollowWellPathSegments,
|
|
|
|
TangentConstantWithinCell
|
|
|
|
};
|
|
|
|
|
2019-11-06 03:07:56 -06:00
|
|
|
std::vector<WbsParameterSource> calculateWbsParameterForAllSegments( const RigWbsParameter& parameter,
|
|
|
|
WbsParameterSource primarySource,
|
2023-01-18 07:42:33 -06:00
|
|
|
int timeStepIndex,
|
2019-11-06 03:07:56 -06:00
|
|
|
int frameIndex,
|
2020-02-13 03:22:22 -06:00
|
|
|
std::vector<double>* outputValues,
|
|
|
|
bool allowNormalization );
|
2019-11-06 03:07:56 -06:00
|
|
|
std::vector<WbsParameterSource> calculateWbsParameterForAllSegments( const RigWbsParameter& parameter,
|
2023-01-18 07:42:33 -06:00
|
|
|
int timeStepIndex,
|
2019-11-06 03:07:56 -06:00
|
|
|
int frameIndex,
|
2020-02-13 03:22:22 -06:00
|
|
|
std::vector<double>* outputValues,
|
|
|
|
bool allowNormalization );
|
2019-11-06 03:07:56 -06:00
|
|
|
std::vector<WbsParameterSource> calculateWbsParametersForAllSegments( const RigFemResultAddress& resAddr,
|
2023-01-18 07:42:33 -06:00
|
|
|
int timeStepIndex,
|
2019-11-06 03:07:56 -06:00
|
|
|
int frameIndex,
|
2020-02-13 03:22:22 -06:00
|
|
|
std::vector<double>* values,
|
2023-02-26 03:48:40 -06:00
|
|
|
bool allowNormalization );
|
2019-09-05 05:24:45 -05:00
|
|
|
|
2020-05-13 06:00:43 -05:00
|
|
|
void wellPathAngles( const RigFemResultAddress& resAddr, std::vector<double>* values );
|
|
|
|
std::vector<WbsParameterSource> wellPathScaledCurveData( const RigFemResultAddress& resAddr,
|
2023-01-18 07:42:33 -06:00
|
|
|
int timeStepIndex,
|
2020-05-13 06:00:43 -05:00
|
|
|
int frameIndex,
|
|
|
|
std::vector<double>* values,
|
2023-02-26 03:48:40 -06:00
|
|
|
bool forceGridSourceforPPReservoir = false );
|
|
|
|
void wellBoreWallCurveData( const RigFemResultAddress& resAddr, int timeStepIndex, int frameIndex, std::vector<double>* values );
|
2019-11-06 03:07:56 -06:00
|
|
|
|
2023-01-18 07:42:33 -06:00
|
|
|
void wellBoreFGShale( int timeStepIndex, int frameIndex, std::vector<double>* values );
|
|
|
|
void wellBoreSH_MatthewsKelly( int timeStepIndex, int frameIndex, std::vector<double>* values );
|
2019-11-06 03:07:56 -06:00
|
|
|
|
2019-09-05 05:24:45 -05:00
|
|
|
template <typename T>
|
2023-02-26 03:48:40 -06:00
|
|
|
T interpolateGridResultValue( RigFemResultPosEnum resultPosType, const std::vector<T>& gridResultValues, int64_t intersectionIdx ) const;
|
|
|
|
size_t gridResultIndexFace( size_t elementIdx, cvf::StructGridInterface::FaceType cellFace, int faceLocalNodeIdx ) const;
|
2019-09-05 05:24:45 -05:00
|
|
|
void calculateIntersection();
|
|
|
|
std::vector<size_t> findCloseCells( const cvf::BoundingBox& bb );
|
2023-02-26 03:48:40 -06:00
|
|
|
cvf::Vec3d calculateLengthInCell( size_t cellIndex, const cvf::Vec3d& startPoint, const cvf::Vec3d& endPoint ) const override;
|
|
|
|
cvf::Vec3d calculateWellPathTangent( int64_t intersectionIdx, WellPathTangentCalculation calculationType ) const;
|
2019-09-05 05:24:45 -05:00
|
|
|
|
|
|
|
cvf::Vec3f cellCentroid( size_t intersectionIdx ) const;
|
2023-02-26 03:48:40 -06:00
|
|
|
double getWellLogIntersectionValue( size_t intersectionIdx, const std::vector<std::pair<double, double>>& wellLogValues ) const;
|
2019-09-05 05:24:45 -05:00
|
|
|
|
2020-02-13 03:22:51 -06:00
|
|
|
template <typename T>
|
|
|
|
bool averageIntersectionValuesToSegmentValue( size_t intersectionIdx,
|
|
|
|
const std::vector<T>& intersectionValues,
|
|
|
|
const T& invalidValue,
|
|
|
|
T* averagedSegmentValue ) const;
|
2019-09-05 05:24:45 -05:00
|
|
|
static double pascalToBar( double pascalValue );
|
2018-06-22 08:30:20 -05:00
|
|
|
|
2019-10-03 07:16:56 -05:00
|
|
|
template <typename T>
|
|
|
|
std::vector<T> interpolateInterfaceValues( RigFemResultAddress nativeAddr,
|
2023-01-18 07:42:33 -06:00
|
|
|
int timeStepIndex,
|
2019-11-06 03:07:56 -06:00
|
|
|
int frameIndex,
|
|
|
|
const std::vector<T>& unscaledResultValues );
|
2019-10-03 07:16:56 -05:00
|
|
|
|
|
|
|
static void initializeResultValues( std::vector<float>& resultValues, size_t resultCount );
|
|
|
|
static void initializeResultValues( std::vector<caf::Ten3d>& resultValues, size_t resultCount );
|
|
|
|
|
|
|
|
void smoothSegments( std::vector<double>* mds,
|
|
|
|
std::vector<double>* tvds,
|
|
|
|
std::vector<double>* values,
|
|
|
|
const std::vector<double>& interfaceShValues,
|
|
|
|
const std::vector<unsigned char>& smoothSegments,
|
|
|
|
const double smoothingThreshold );
|
|
|
|
|
|
|
|
std::vector<unsigned char> determineFilteringOrSmoothing( const std::vector<double>& porePressures );
|
|
|
|
|
2023-02-26 03:48:40 -06:00
|
|
|
double hydroStaticPorePressureForIntersection( size_t intersectionIdx, double waterDensityGCM3 = PURE_WATER_DENSITY_GCM3 ) const;
|
|
|
|
double hydroStaticPorePressureForSegment( size_t intersectionIdx, double waterDensityGCM3 = PURE_WATER_DENSITY_GCM3 ) const;
|
2020-02-10 05:39:16 -06:00
|
|
|
|
|
|
|
double wbsCurveValuesAtMsl() const;
|
2019-11-06 03:07:56 -06:00
|
|
|
|
|
|
|
static bool isValid( double value );
|
|
|
|
static bool isValid( float value );
|
|
|
|
|
2021-01-15 03:32:36 -06:00
|
|
|
double calculateWaterDepth() const;
|
|
|
|
|
2018-09-03 04:24:35 -05:00
|
|
|
private:
|
2019-11-06 03:07:56 -06:00
|
|
|
cvf::ref<RigGeoMechCaseData> m_caseData;
|
|
|
|
|
|
|
|
std::map<RigWbsParameter, std::vector<std::pair<double, double>>> m_lasFileValues;
|
2020-01-29 05:52:07 -06:00
|
|
|
std::map<RigWbsParameter, QString> m_lasFileInputUnits;
|
|
|
|
std::map<RigWbsParameter, WbsParameterSource> m_parameterSources;
|
|
|
|
std::map<RigWbsParameter, double> m_userDefinedValues;
|
2021-01-15 03:32:36 -06:00
|
|
|
|
|
|
|
double m_waterDepth;
|
2023-05-12 01:13:56 -05:00
|
|
|
int m_partId;
|
|
|
|
bool m_valid;
|
2019-09-05 05:24:45 -05:00
|
|
|
};
|