#5663 Fix element property input for UCS

This commit is contained in:
Gaute Lindkvist 2020-03-10 18:43:11 +01:00
parent 2b7cbee0a6
commit 1c75d9b4bd
16 changed files with 219 additions and 146 deletions

View File

@ -42,7 +42,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiaCellDividingTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaFieldHandleTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaBoundingBoxTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaWellLogUnitTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaWellLogUnitTools.inl
)
set (SOURCE_GROUP_SOURCE_FILES
@ -82,7 +82,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RiaGitDiff.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaCellDividingTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaFieldHandleTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaBoundingBoxTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaWellLogUnitTools.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -25,11 +25,13 @@
class RigWellPath;
template <typename FloatType>
class RiaWellLogUnitTools
{
public:
static const double GRAVITY_ACCEL;
static const double UNIT_WEIGHT_OF_WATER;
static const FloatType gravityAcceleration();
static const FloatType unitWeightOfWater();
static bool stringsMatch( const QString& lhs, const QString& rhs );
static QString noUnitString();
static QString sg_emwUnitString();
@ -39,35 +41,38 @@ public:
static QString gPerCm3UnitString();
static QString kgPerM3UnitString();
static QString pascalUnitString();
static QString pascalUnitStringShort();
public:
static std::vector<double> convertDepths( const std::vector<double>& depthsIn,
RiaDefines::DepthUnitType unitsIn,
RiaDefines::DepthUnitType unitsOut );
static bool convertValues( const std::vector<double>& tvdRKBs,
const std::vector<double>& valuesIn,
std::vector<double>* valuesOut,
const QString& unitsIn,
const QString& unitsOut );
static bool convertValues( std::vector<std::pair<double, double>>* measuredDepthsAndValues,
const QString& unitsIn,
const QString& unitsOut,
const RigWellPath* wellPath );
static std::vector<FloatType> convertDepths( const std::vector<FloatType>& depthsIn,
RiaDefines::DepthUnitType unitsIn,
RiaDefines::DepthUnitType unitsOut );
static bool convertValues( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& valuesIn,
std::vector<FloatType>* valuesOut,
const QString& unitsIn,
const QString& unitsOut );
static bool convertValues( std::vector<std::pair<FloatType, FloatType>>* measuredDepthsAndValues,
const QString& unitsIn,
const QString& unitsOut,
const RigWellPath* wellPath );
static std::vector<double> tvdRKBs( const std::vector<double>& measuredDepths, const RigWellPath* wellPath );
static std::vector<FloatType> tvdRKBs( const std::vector<FloatType>& measuredDepths, const RigWellPath* wellPath );
// Supported conversions
static std::vector<double> convertGpcm3ToBar( const std::vector<double>& tvdRKBs,
const std::vector<double>& valuesInGpcm3 );
static std::vector<double> convertBarToGpcm3( const std::vector<double>& tvdRKBs,
const std::vector<double>& valuesInBar );
static std::vector<FloatType> convertGpcm3ToBar( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& valuesInGpcm3 );
static std::vector<FloatType> convertBarToGpcm3( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& valuesInBar );
static std::vector<double> convertNormalizedByPPToBar( const std::vector<double>& tvdRKBs,
const std::vector<double>& valuesInBar );
static std::vector<double> convertBarToNormalizedByPP( const std::vector<double>& tvdRKBs,
const std::vector<double>& valuesInBar );
static std::vector<double> multiply( const std::vector<double>& values, double factor );
static double pascalPerBar();
static double MPaPerBar();
static double hydrostaticPorePressureBar( double tvdRKB );
static std::vector<FloatType> convertNormalizedByPPToBar( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& valuesInBar );
static std::vector<FloatType> convertBarToNormalizedByPP( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& valuesInBar );
static std::vector<FloatType> multiply( const std::vector<FloatType>& values, FloatType factor );
static FloatType pascalPerBar();
static FloatType MPaPerBar();
static FloatType hydrostaticPorePressureBar( FloatType tvdRKB );
};
#include "RiaWellLogUnitTools.inl"

View File

@ -15,8 +15,6 @@
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiaWellLogUnitTools.h"
#include "RiaEclipseUnitTools.h"
#include "RigWellPath.h"
@ -24,10 +22,30 @@
#include <limits>
const double RiaWellLogUnitTools::GRAVITY_ACCEL = 9.81;
const double RiaWellLogUnitTools::UNIT_WEIGHT_OF_WATER = RiaWellLogUnitTools::GRAVITY_ACCEL * 1000.0; // N / m^3
bool stringsMatch( const QString& lhs, const QString& rhs )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <typename FloatType>
const FloatType RiaWellLogUnitTools<FloatType>::gravityAcceleration()
{
return (FloatType) 9.81;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <typename FloatType>
const FloatType RiaWellLogUnitTools<FloatType>::unitWeightOfWater()
{
return RiaWellLogUnitTools<FloatType>::gravityAcceleration() * 1000.0; // N / m^3
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <typename FloatType>
bool RiaWellLogUnitTools<FloatType>::stringsMatch( const QString& lhs, const QString& rhs )
{
return QString::compare( lhs, rhs, Qt::CaseInsensitive ) == 0;
}
@ -35,7 +53,8 @@ bool stringsMatch( const QString& lhs, const QString& rhs )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaWellLogUnitTools::noUnitString()
template <typename FloatType>
QString RiaWellLogUnitTools<FloatType>::noUnitString()
{
return "NO_UNIT";
}
@ -43,7 +62,8 @@ QString RiaWellLogUnitTools::noUnitString()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaWellLogUnitTools::sg_emwUnitString()
template <typename FloatType>
QString RiaWellLogUnitTools<FloatType>::sg_emwUnitString()
{
return "sg_EMW";
}
@ -51,7 +71,8 @@ QString RiaWellLogUnitTools::sg_emwUnitString()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaWellLogUnitTools::barUnitString()
template <typename FloatType>
QString RiaWellLogUnitTools<FloatType>::barUnitString()
{
return "Bar";
}
@ -59,7 +80,8 @@ QString RiaWellLogUnitTools::barUnitString()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaWellLogUnitTools::barX100UnitString()
template <typename FloatType>
QString RiaWellLogUnitTools<FloatType>::barX100UnitString()
{
return "Bar x100";
}
@ -67,7 +89,8 @@ QString RiaWellLogUnitTools::barX100UnitString()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaWellLogUnitTools::MPaUnitString()
template <typename FloatType>
QString RiaWellLogUnitTools<FloatType>::MPaUnitString()
{
return "MPa";
}
@ -75,7 +98,8 @@ QString RiaWellLogUnitTools::MPaUnitString()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaWellLogUnitTools::gPerCm3UnitString()
template <typename FloatType>
QString RiaWellLogUnitTools<FloatType>::gPerCm3UnitString()
{
return "g/cm3";
}
@ -83,7 +107,8 @@ QString RiaWellLogUnitTools::gPerCm3UnitString()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaWellLogUnitTools::kgPerM3UnitString()
template <typename FloatType>
QString RiaWellLogUnitTools<FloatType>::kgPerM3UnitString()
{
return "kg/m3";
}
@ -91,7 +116,8 @@ QString RiaWellLogUnitTools::kgPerM3UnitString()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaWellLogUnitTools::pascalUnitString()
template <typename FloatType>
QString RiaWellLogUnitTools<FloatType>::pascalUnitString()
{
return "pascal";
}
@ -99,7 +125,17 @@ QString RiaWellLogUnitTools::pascalUnitString()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RiaWellLogUnitTools::convertDepths( const std::vector<double>& depthsIn,
template <typename FloatType>
QString RiaWellLogUnitTools<FloatType>::pascalUnitStringShort()
{
return "pa";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <typename FloatType>
std::vector<FloatType> RiaWellLogUnitTools<FloatType>::convertDepths( const std::vector<FloatType>& depthsIn,
RiaDefines::DepthUnitType unitsIn,
RiaDefines::DepthUnitType unitsOut )
{
@ -117,9 +153,10 @@ std::vector<double> RiaWellLogUnitTools::convertDepths( const std::vector<double
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaWellLogUnitTools::convertValues( const std::vector<double>& tvdRKBs,
const std::vector<double>& valuesIn,
std::vector<double>* valuesOut,
template <typename FloatType>
bool RiaWellLogUnitTools<FloatType>::convertValues( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& valuesIn,
std::vector<FloatType>* valuesOut,
const QString& unitsIn,
const QString& unitsOut )
{
@ -162,13 +199,13 @@ bool RiaWellLogUnitTools::convertValues( const std::vector<double>& tvdRKBs,
}
else if ( stringsMatch( unitsIn, barX100UnitString() ) && stringsMatch( unitsOut, MPaUnitString() ) )
{
*valuesOut = multiply( valuesIn, 100.0 );
*valuesOut = multiply( valuesIn, (FloatType)100.0 );
*valuesOut = multiply( *valuesOut, MPaPerBar() );
return true;
}
else if ( stringsMatch( unitsIn, barX100UnitString() ) && stringsMatch( unitsOut, barUnitString() ) )
{
*valuesOut = multiply( valuesIn, 100 );
*valuesOut = multiply( valuesIn, (FloatType)100 );
return true;
}
else if ( stringsMatch( unitsIn, barUnitString() ) && stringsMatch( unitsOut, MPaUnitString() ) )
@ -178,7 +215,7 @@ bool RiaWellLogUnitTools::convertValues( const std::vector<double>& tvdRKBs,
}
else if ( stringsMatch( unitsIn, barUnitString() ) && stringsMatch( unitsOut, barX100UnitString() ) )
{
*valuesOut = multiply( valuesIn, 1.0 / 100.0 );
*valuesOut = multiply( valuesIn, (FloatType) 0.01 );
return true;
}
else if ( ( stringsMatch( unitsIn, noUnitString() ) || stringsMatch( unitsIn, sg_emwUnitString() ) ) &&
@ -193,12 +230,12 @@ bool RiaWellLogUnitTools::convertValues( const std::vector<double>& tvdRKBs,
*valuesOut = convertBarToNormalizedByPP( tvdRKBs, valuesIn );
return true;
}
else if ( stringsMatch( unitsIn, pascalUnitString() ) && stringsMatch( unitsOut, barUnitString() ) )
else if ( (stringsMatch( unitsIn, pascalUnitString()) || stringsMatch( unitsIn, pascalUnitString() ) && stringsMatch( unitsOut, barUnitString() ) ))
{
*valuesOut = multiply( valuesIn, 1.0 / pascalPerBar() );
return true;
}
else if ( stringsMatch( unitsIn, barUnitString() ) && stringsMatch( unitsOut, pascalUnitString() ) )
else if ( stringsMatch( unitsIn, barUnitString() ) && (stringsMatch( unitsIn, pascalUnitString()) || stringsMatch( unitsIn, pascalUnitString() )) )
{
*valuesOut = multiply( valuesIn, pascalPerBar() );
return true;
@ -209,7 +246,8 @@ bool RiaWellLogUnitTools::convertValues( const std::vector<double>& tvdRKBs,
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaWellLogUnitTools::convertValues( std::vector<std::pair<double, double>>* measuredDepthsAndValues,
template <typename FloatType>
bool RiaWellLogUnitTools<FloatType>::convertValues( std::vector<std::pair<FloatType, FloatType>>* measuredDepthsAndValues,
const QString& unitsIn,
const QString& unitsOut,
const RigWellPath* wellPath )
@ -217,8 +255,8 @@ bool RiaWellLogUnitTools::convertValues( std::vector<std::pair<double, double>>*
CAF_ASSERT( measuredDepthsAndValues );
if ( unitsIn == unitsOut ) return true;
std::vector<double> tvdRKBs( measuredDepthsAndValues->size(), 0.0 );
std::vector<double> values( measuredDepthsAndValues->size(), 0.0 );
std::vector<FloatType> tvdRKBs( measuredDepthsAndValues->size(), 0.0 );
std::vector<FloatType> values( measuredDepthsAndValues->size(), 0.0 );
for ( size_t i = 0; i < measuredDepthsAndValues->size(); ++i )
{
auto depthValuePair = ( *measuredDepthsAndValues )[i];
@ -227,7 +265,7 @@ bool RiaWellLogUnitTools::convertValues( std::vector<std::pair<double, double>>*
tvdRKBs[i] = -point.z() + wellPath->rkbDiff();
values[i] = depthValuePair.second;
}
std::vector<double> valuesOut;
std::vector<FloatType> valuesOut;
if ( convertValues( tvdRKBs, values, &valuesOut, unitsIn, unitsOut ) )
{
CAF_ASSERT( measuredDepthsAndValues->size() == valuesOut.size() );
@ -243,7 +281,8 @@ bool RiaWellLogUnitTools::convertValues( std::vector<std::pair<double, double>>*
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RiaWellLogUnitTools::tvdRKBs( const std::vector<double>& measuredDepths, const RigWellPath* wellPath )
template <typename FloatType>
std::vector<FloatType> RiaWellLogUnitTools<FloatType>::tvdRKBs( const std::vector<FloatType>& measuredDepths, const RigWellPath* wellPath )
{
std::vector<double> tvdRKBs( measuredDepths.size(), 0.0 );
for ( size_t i = 0; i < measuredDepths.size(); ++i )
@ -251,28 +290,29 @@ std::vector<double> RiaWellLogUnitTools::tvdRKBs( const std::vector<double>& mea
cvf::Vec3d point = wellPath->interpolatedPointAlongWellPath( measuredDepths[i] );
tvdRKBs[i] = -point.z() + wellPath->rkbDiff();
}
return tvdRKBs;
return std::vector<FloatType>(tvdRKBs.begin(), tvdRKBs.end());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RiaWellLogUnitTools::convertGpcm3ToBar( const std::vector<double>& tvdRKBs,
const std::vector<double>& valuesInGpcm3 )
template <typename FloatType>
std::vector<FloatType> RiaWellLogUnitTools<FloatType>::convertGpcm3ToBar( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& valuesInGpcm3 )
{
CAF_ASSERT( tvdRKBs.size() == valuesInGpcm3.size() );
std::vector<double> valuesInBar( valuesInGpcm3.size(), 0.0 );
std::vector<FloatType> valuesInBar( valuesInGpcm3.size(), 0.0 );
for ( size_t i = 0; i < tvdRKBs.size(); ++i )
{
// We need SI as input (kg / m^3), so multiply by 1000:
double mudWeightsSI = valuesInGpcm3[i] * 1000;
FloatType mudWeightsSI = valuesInGpcm3[i] * 1000;
// To get specific mudWeight (N / m^3):
double specificMudWeight = mudWeightsSI * GRAVITY_ACCEL;
FloatType specificMudWeight = mudWeightsSI * gravityAcceleration();
// Pore pressure in pascal
double valuePascal = specificMudWeight * tvdRKBs[i];
FloatType valuePascal = specificMudWeight * tvdRKBs[i];
// Pore pressure in bar
valuesInBar[i] = 1.0 / pascalPerBar() * valuePascal;
@ -283,22 +323,23 @@ std::vector<double> RiaWellLogUnitTools::convertGpcm3ToBar( const std::vector<do
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RiaWellLogUnitTools::convertBarToGpcm3( const std::vector<double>& tvdRKBs,
const std::vector<double>& valuesInBar )
template <typename FloatType>
std::vector<FloatType> RiaWellLogUnitTools<FloatType>::convertBarToGpcm3( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& valuesInBar )
{
CAF_ASSERT( tvdRKBs.size() == valuesInBar.size() );
std::vector<double> valuesInGpcm3( valuesInBar.size(), 0.0 );
std::vector<FloatType> valuesInGpcm3( valuesInBar.size(), 0.0 );
for ( size_t i = 0; i < tvdRKBs.size(); ++i )
{
// Pore pressure in pascal (N / m^2)
double valuePascal = pascalPerBar() * valuesInBar[i];
FloatType valuePascal = pascalPerBar() * valuesInBar[i];
// N / m^3:
double specificMudWeight = valuePascal / tvdRKBs[i];
FloatType specificMudWeight = valuePascal / tvdRKBs[i];
// Mud weight in SI (kg / m^3):
double mudWeightsSI = specificMudWeight / GRAVITY_ACCEL;
FloatType mudWeightsSI = specificMudWeight / gravityAcceleration();
// Mud weights g/cm^3:
valuesInGpcm3[i] = mudWeightsSI / 1000;
@ -309,12 +350,13 @@ std::vector<double> RiaWellLogUnitTools::convertBarToGpcm3( const std::vector<do
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RiaWellLogUnitTools::convertNormalizedByPPToBar( const std::vector<double>& tvdRKBs,
const std::vector<double>& normalizedValues )
template<typename FloatType>
std::vector<FloatType> RiaWellLogUnitTools<FloatType>::convertNormalizedByPPToBar( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& normalizedValues )
{
CAF_ASSERT( tvdRKBs.size() == normalizedValues.size() );
std::vector<double> valuesInBar( tvdRKBs.size(), 0.0 );
std::vector<FloatType> valuesInBar( tvdRKBs.size(), 0.0 );
for ( size_t i = 0; i < tvdRKBs.size(); ++i )
{
valuesInBar[i] = normalizedValues[i] * hydrostaticPorePressureBar( tvdRKBs[i] );
@ -325,12 +367,13 @@ std::vector<double> RiaWellLogUnitTools::convertNormalizedByPPToBar( const std::
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RiaWellLogUnitTools::convertBarToNormalizedByPP( const std::vector<double>& tvdRKBs,
const std::vector<double>& valuesInBar )
template <typename FloatType>
std::vector<FloatType> RiaWellLogUnitTools<FloatType>::convertBarToNormalizedByPP( const std::vector<FloatType>& tvdRKBs,
const std::vector<FloatType>& valuesInBar )
{
CAF_ASSERT( tvdRKBs.size() == valuesInBar.size() );
std::vector<double> normalizedValues( tvdRKBs.size(), 0.0 );
std::vector<FloatType> normalizedValues( tvdRKBs.size(), 0.0 );
for ( size_t i = 0; i < tvdRKBs.size(); ++i )
{
normalizedValues[i] = valuesInBar[i] / hydrostaticPorePressureBar( tvdRKBs[i] );
@ -341,9 +384,10 @@ std::vector<double> RiaWellLogUnitTools::convertBarToNormalizedByPP( const std::
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RiaWellLogUnitTools::multiply( const std::vector<double>& valuesIn, double factor )
template <typename FloatType>
std::vector<FloatType> RiaWellLogUnitTools<FloatType>::multiply( const std::vector<FloatType>& valuesIn, FloatType factor )
{
std::vector<double> valuesOut( valuesIn.size(), std::numeric_limits<double>::infinity() );
std::vector<FloatType> valuesOut( valuesIn.size(), std::numeric_limits<FloatType>::infinity() );
for ( size_t i = 0; i < valuesIn.size(); ++i )
{
valuesOut[i] = valuesIn[i] * factor;
@ -354,7 +398,8 @@ std::vector<double> RiaWellLogUnitTools::multiply( const std::vector<double>& va
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RiaWellLogUnitTools::pascalPerBar()
template <typename FloatType>
FloatType RiaWellLogUnitTools<FloatType>::pascalPerBar()
{
return 1.0e5;
}
@ -362,15 +407,17 @@ double RiaWellLogUnitTools::pascalPerBar()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RiaWellLogUnitTools::MPaPerBar()
template <typename FloatType>
FloatType RiaWellLogUnitTools<FloatType>::MPaPerBar()
{
return 1.0e-1;
return (FloatType) 1.0e-1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RiaWellLogUnitTools::hydrostaticPorePressureBar( double depth )
template <typename FloatType>
FloatType RiaWellLogUnitTools<FloatType>::hydrostaticPorePressureBar( FloatType depth )
{
return 1.0 / pascalPerBar() * depth * UNIT_WEIGHT_OF_WATER;
return (FloatType) 1.0 / pascalPerBar() * depth * unitWeightOfWater();
}

View File

@ -1287,10 +1287,10 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateNormalizedResult
// This is in the POR-region. Use hydrostatic pressure from the individual nodes
for ( int elmLocalNodeIdx = 0; elmLocalNodeIdx < 8; ++elmLocalNodeIdx )
{
size_t elmNodeResIdx = femPart->elementNodeResultIdx( elmIdx, elmLocalNodeIdx );
const int nodeIdx = femPart->nodeIdxFromElementNodeResultIdx( elmNodeResIdx );
double tvdRKB = std::abs( nodeCoords[nodeIdx].z() ) + m_normalizationAirGap;
double hydrostaticPressure = RiaWellLogUnitTools::hydrostaticPorePressureBar( tvdRKB );
size_t elmNodeResIdx = femPart->elementNodeResultIdx( elmIdx, elmLocalNodeIdx );
const int nodeIdx = femPart->nodeIdxFromElementNodeResultIdx( elmNodeResIdx );
double tvdRKB = std::abs( nodeCoords[nodeIdx].z() ) + m_normalizationAirGap;
double hydrostaticPressure = RiaWellLogUnitTools<double>::hydrostaticPorePressureBar( tvdRKB );
dstFrameData[elmNodeResIdx] /= hydrostaticPressure;
}
}
@ -1300,7 +1300,7 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateNormalizedResult
cvf::Vec3d cellCentroid = femPartGrid->cellCentroid( elmIdx );
double cellCentroidTvdRKB = std::abs( cellCentroid.z() ) + m_normalizationAirGap;
double cellCenterHydroStaticPressure =
RiaWellLogUnitTools::hydrostaticPorePressureBar( cellCentroidTvdRKB );
RiaWellLogUnitTools<double>::hydrostaticPorePressureBar( cellCentroidTvdRKB );
for ( int elmLocalNodeIdx = 0; elmLocalNodeIdx < 8; ++elmLocalNodeIdx )
{

View File

@ -119,7 +119,7 @@ QString RimWellFlowRateCurve::wellLogChannelUiName() const
//--------------------------------------------------------------------------------------------------
QString RimWellFlowRateCurve::wellLogChannelUnits() const
{
return RiaWellLogUnitTools::noUnitString();
return RiaWellLogUnitTools<double>::noUnitString();
}
//--------------------------------------------------------------------------------------------------

View File

@ -787,12 +787,12 @@ QString RimGeoMechResultDefinition::currentResultUnits() const
{
if ( resultName == this->resultFieldName() )
{
return RiaWellLogUnitTools::sg_emwUnitString();
return RiaWellLogUnitTools<double>::sg_emwUnitString();
}
}
}
return RiaWellLogUnitTools::noUnitString();
return RiaWellLogUnitTools<double>::noUnitString();
}
//--------------------------------------------------------------------------------------------------
@ -919,7 +919,7 @@ void RimGeoMechResultDefinition::updateLegendTextAndRanges( RimRegularLegendConf
}
QString unitString = currentResultUnits();
if ( unitString != RiaWellLogUnitTools::noUnitString() )
if ( unitString != RiaWellLogUnitTools<double>::noUnitString() )
{
legendTitle += QString( " [%1]" ).arg( unitString );
}

View File

@ -49,20 +49,20 @@ public:
double rkbDiff,
RiaDefines::DepthUnitType depthUnit,
bool isExtractionCurve,
const QString& xUnits = RiaWellLogUnitTools::noUnitString() );
const QString& xUnits = RiaWellLogUnitTools<double>::noUnitString() );
void setValuesWithMdAndTVD( const std::vector<double>& xValues,
const std::vector<double>& measuredDepths,
const std::vector<double>& tvDepths,
double rkbDiff,
RiaDefines::DepthUnitType depthUnit,
bool isExtractionCurve,
const QString& xUnits = RiaWellLogUnitTools::noUnitString() );
const QString& xUnits = RiaWellLogUnitTools<double>::noUnitString() );
void setValuesAndDepths( const std::vector<double>& xValues,
const std::map<RiaDefines::DepthTypeEnum, std::vector<double>>& depths,
double rkbDiff,
RiaDefines::DepthUnitType depthUnit,
bool isExtractionCurve,
const QString& xUnits = RiaWellLogUnitTools::noUnitString() );
const QString& xUnits = RiaWellLogUnitTools<double>::noUnitString() );
const RigWellLogCurveData* curveData() const;

View File

@ -451,7 +451,7 @@ void RimWellLogExtractionCurve::extractData( bool* isUsingPseudoLength,
double rkbDiff = 0.0;
RiaDefines::DepthUnitType depthUnit = RiaDefines::UNIT_METER;
QString xUnits = RiaWellLogUnitTools::noUnitString();
QString xUnits = RiaWellLogUnitTools<double>::noUnitString();
if ( eclExtractor.notNull() && eclipseCase )
{
@ -554,7 +554,10 @@ void RimWellLogExtractionCurve::findAndLoadWbsParametersFromLasFiles( const RimW
{
QString extractorUnits = geomExtractor->parameterInputUnits( parameter );
if ( RiaWellLogUnitTools::convertValues( &lasFileValues, lasUnits, extractorUnits, wellPath->wellPathGeometry() ) )
if ( RiaWellLogUnitTools<double>::convertValues( &lasFileValues,
lasUnits,
extractorUnits,
wellPath->wellPathGeometry() ) )
{
geomExtractor->setWbsLasValues( parameter, lasFileValues );
}
@ -905,7 +908,7 @@ QString RimWellLogExtractionCurve::wellLogChannelUnits() const
QString name;
if ( eclipseCase )
{
name = RiaWellLogUnitTools::noUnitString();
name = RiaWellLogUnitTools<double>::noUnitString();
}
else if ( geoMechCase )
{

View File

@ -439,7 +439,7 @@ QString RimWellLogFileCurve::wellLogChannelUnits() const
{
return m_wellLogFile->wellLogFileData()->wellLogChannelUnitString( m_wellLogChannelName );
}
return RiaWellLogUnitTools::noUnitString();
return RiaWellLogUnitTools<double>::noUnitString();
}
//--------------------------------------------------------------------------------------------------

View File

@ -151,7 +151,7 @@ QString RimWellLogRftCurve::wellLogChannelUiName() const
//--------------------------------------------------------------------------------------------------
QString RimWellLogRftCurve::wellLogChannelUnits() const
{
return RiaWellLogUnitTools::noUnitString();
return RiaWellLogUnitTools<double>::noUnitString();
}
//--------------------------------------------------------------------------------------------------

View File

@ -285,7 +285,7 @@ QString RimWellMeasurementCurve::wellLogChannelUiName() const
//--------------------------------------------------------------------------------------------------
QString RimWellMeasurementCurve::wellLogChannelUnits() const
{
return RiaWellLogUnitTools::noUnitString();
return RiaWellLogUnitTools<double>::noUnitString();
}
//--------------------------------------------------------------------------------------------------

View File

@ -178,16 +178,16 @@ QString RigGeoMechWellLogExtractor::curveData( const RigFemResultAddress& resAdd
{
if ( isValid( value ) ) value /= 100.0;
}
return RiaWellLogUnitTools::barX100UnitString();
return RiaWellLogUnitTools<double>::barX100UnitString();
}
else if ( param == RigWbsParameter::DF() || param == RigWbsParameter::poissonRatio() )
{
return RiaWellLogUnitTools::noUnitString();
return RiaWellLogUnitTools<double>::noUnitString();
}
}
}
}
return RiaWellLogUnitTools::sg_emwUnitString();
return RiaWellLogUnitTools<double>::sg_emwUnitString();
}
else if ( resAddr.isValid() )
{
@ -215,7 +215,7 @@ QString RigGeoMechWellLogExtractor::curveData( const RigFemResultAddress& resAdd
}
}
}
return RiaWellLogUnitTools::barUnitString();
return RiaWellLogUnitTools<double>::barUnitString();
}
//--------------------------------------------------------------------------------------------------
@ -268,11 +268,23 @@ std::vector<RigGeoMechWellLogExtractor::WbsParameterSource>
const std::vector<std::pair<double, double>>& lasFileValues = m_lasFileValues.at( parameter );
const double& userDefinedValue = m_userDefinedValues.at( parameter );
const std::vector<float>* elementPropertyValues = nullptr;
std::vector<float> elementPropertyValues;
if ( std::find( allSources.begin(), allSources.end(), RigWbsParameter::ELEMENT_PROPERTY_TABLE ) != allSources.end() )
{
const std::vector<float>* elementPropertyValuesInput = nullptr;
std::vector<float> tvdRKBs;
for ( double tvdValue : m_intersectionTVDs )
{
tvdRKBs.push_back( tvdValue + m_wellPath->rkbDiff() );
}
RigFemResultAddress elementPropertyAddr = parameter.femAddress( RigWbsParameter::ELEMENT_PROPERTY_TABLE );
elementPropertyValues = &( resultCollection->resultValues( elementPropertyAddr, 0, frameIndex ) );
elementPropertyValuesInput = &( resultCollection->resultValues( elementPropertyAddr, 0, frameIndex ) );
RiaWellLogUnitTools<float>::convertValues( tvdRKBs,
*elementPropertyValuesInput,
&elementPropertyValues,
parameter.units( RigWbsParameter::ELEMENT_PROPERTY_TABLE ),
parameterInputUnits( parameter ) );
}
std::vector<double> unscaledValues( m_intersections.size(), std::numeric_limits<double>::infinity() );
@ -310,11 +322,11 @@ std::vector<RigGeoMechWellLogExtractor::WbsParameterSource>
}
else if ( *it == RigWbsParameter::ELEMENT_PROPERTY_TABLE ) // Priority 2: Element property table value
{
CVF_ASSERT( elementPropertyValues );
CVF_ASSERT( !elementPropertyValues.empty() );
size_t elmIdx = m_intersectedCellsGlobIdx[intersectionIdx];
if ( elmIdx < elementPropertyValues->size() )
if ( elmIdx < elementPropertyValues.size() )
{
unscaledValues[intersectionIdx] = ( *elementPropertyValues )[elmIdx];
unscaledValues[intersectionIdx] = elementPropertyValues[elmIdx];
finalSourcesPerSegment[intersectionIdx] = RigWbsParameter::ELEMENT_PROPERTY_TABLE;
break;
}
@ -767,17 +779,17 @@ QString RigGeoMechWellLogExtractor::parameterInputUnits( const RigWbsParameter&
if ( parameter == RigWbsParameter::PP_NonReservoir() || parameter == RigWbsParameter::PP_Reservoir() ||
parameter == RigWbsParameter::UCS() )
{
return RiaWellLogUnitTools::barUnitString();
return RiaWellLogUnitTools<double>::barUnitString();
}
else if ( parameter == RigWbsParameter::poissonRatio() || parameter == RigWbsParameter::DF() )
{
return RiaWellLogUnitTools::noUnitString();
return RiaWellLogUnitTools<double>::noUnitString();
}
else if ( parameter == RigWbsParameter::waterDensity() )
{
return RiaWellLogUnitTools::gPerCm3UnitString();
return RiaWellLogUnitTools<double>::gPerCm3UnitString();
}
return RiaWellLogUnitTools::sg_emwUnitString();
return RiaWellLogUnitTools<double>::sg_emwUnitString();
}
//--------------------------------------------------------------------------------------------------

View File

@ -526,7 +526,7 @@ void RigLasFileExporter::appendLasFileDescriptions( const std::vector<RimWellLog
}
QString units = curve->curveData()->xUnits();
if ( convertCurveUnits || units == RiaWellLogUnitTools::barX100UnitString() )
if ( convertCurveUnits || units == RiaWellLogUnitTools<double>::barX100UnitString() )
{
units = curve->wellLogChannelUnits();
}

View File

@ -136,7 +136,7 @@ QString RigWbsParameter::units( Source source ) const
{
return m_sources.front().second.units;
}
return RiaWellLogUnitTools::noUnitString();
return RiaWellLogUnitTools<double>::noUnitString();
}
//--------------------------------------------------------------------------------------------------
@ -238,13 +238,13 @@ bool RigWbsParameter::operator<( const RigWbsParameter& rhs ) const
//--------------------------------------------------------------------------------------------------
RigWbsParameter RigWbsParameter::PP_Reservoir()
{
SourceVector sources = {{GRID, SourceAddress( "POR-Bar", "", RiaWellLogUnitTools::barUnitString() )},
{LAS_FILE, SourceAddress( "PP_INP", "", RiaWellLogUnitTools::sg_emwUnitString() )},
{LAS_FILE, SourceAddress( "PP_RES_INP", "", RiaWellLogUnitTools::sg_emwUnitString() )},
{LAS_FILE, SourceAddress( "POR_RES_INP", "", RiaWellLogUnitTools::gPerCm3UnitString() )},
{ELEMENT_PROPERTY_TABLE, SourceAddress( "POR_INP", "", RiaWellLogUnitTools::barUnitString() )},
{ELEMENT_PROPERTY_TABLE,
SourceAddress( "PP_INP", "", RiaWellLogUnitTools::sg_emwUnitString() )}};
SourceVector sources =
{{GRID, SourceAddress( "POR-Bar", "", RiaWellLogUnitTools<double>::barUnitString() )},
{LAS_FILE, SourceAddress( "PP_INP", "", RiaWellLogUnitTools<double>::sg_emwUnitString() )},
{LAS_FILE, SourceAddress( "PP_RES_INP", "", RiaWellLogUnitTools<double>::sg_emwUnitString() )},
{LAS_FILE, SourceAddress( "POR_RES_INP", "", RiaWellLogUnitTools<double>::gPerCm3UnitString() )},
{ELEMENT_PROPERTY_TABLE, SourceAddress( "POR_INP", "", RiaWellLogUnitTools<double>::pascalUnitString() )},
{ELEMENT_PROPERTY_TABLE, SourceAddress( "PP_INP", "", RiaWellLogUnitTools<double>::sg_emwUnitString() )}};
return RigWbsParameter( "PP Reservoir", true, sources );
}
@ -255,10 +255,13 @@ RigWbsParameter RigWbsParameter::PP_NonReservoir()
{
return RigWbsParameter( "PP Non-Reservoir",
true,
{{LAS_FILE, SourceAddress( "PP_NONRES_INP", "", RiaWellLogUnitTools::sg_emwUnitString() )},
{LAS_FILE, SourceAddress( "POR_NONRES_INP", "", RiaWellLogUnitTools::gPerCm3UnitString() )},
{USER_DEFINED, SourceAddress( "", "", RiaWellLogUnitTools::barUnitString() )},
{HYDROSTATIC, SourceAddress( "Hydrostatic", "", RiaWellLogUnitTools::barUnitString() )}} );
{{LAS_FILE,
SourceAddress( "PP_NONRES_INP", "", RiaWellLogUnitTools<double>::sg_emwUnitString() )},
{LAS_FILE,
SourceAddress( "POR_NONRES_INP", "", RiaWellLogUnitTools<double>::gPerCm3UnitString() )},
{USER_DEFINED, SourceAddress( "", "", RiaWellLogUnitTools<double>::barUnitString() )},
{HYDROSTATIC,
SourceAddress( "Hydrostatic", "", RiaWellLogUnitTools<double>::barUnitString() )}} );
}
//--------------------------------------------------------------------------------------------------
@ -280,9 +283,10 @@ RigWbsParameter RigWbsParameter::UCS()
{
return RigWbsParameter( "UCS",
false,
{{LAS_FILE, SourceAddress( "UCS_INP", "", RiaWellLogUnitTools::MPaUnitString() )},
{ELEMENT_PROPERTY_TABLE, SourceAddress( "UCS_INP", RiaWellLogUnitTools::barUnitString() )},
{USER_DEFINED, SourceAddress( "", "", RiaWellLogUnitTools::barUnitString() )}} );
{{LAS_FILE, SourceAddress( "UCS_INP", "", RiaWellLogUnitTools<double>::MPaUnitString() )},
{ELEMENT_PROPERTY_TABLE,
SourceAddress( "UCS_INP", "", RiaWellLogUnitTools<double>::pascalUnitString() )},
{USER_DEFINED, SourceAddress( "", "", RiaWellLogUnitTools<double>::barUnitString() )}} );
}
//--------------------------------------------------------------------------------------------------
@ -291,8 +295,8 @@ RigWbsParameter RigWbsParameter::UCS()
RigWbsParameter RigWbsParameter::OBG()
{
std::vector<std::pair<Source, SourceAddress>> sources =
{{GRID, SourceAddress( "ST", "S33", RiaWellLogUnitTools::barUnitString() )},
{LAS_FILE, SourceAddress( "OBG_INP", "", RiaWellLogUnitTools::barUnitString() )}};
{{GRID, SourceAddress( "ST", "S33", RiaWellLogUnitTools<double>::barUnitString() )},
{LAS_FILE, SourceAddress( "OBG_INP", "", RiaWellLogUnitTools<double>::barUnitString() )}};
return RigWbsParameter( "OBG Input", true, sources );
}
@ -302,8 +306,8 @@ RigWbsParameter RigWbsParameter::OBG()
RigWbsParameter RigWbsParameter::OBG0()
{
std::vector<std::pair<Source, SourceAddress>> sources =
{{GRID, SourceAddress( "ST", "S33", RiaWellLogUnitTools::barUnitString() )},
{LAS_FILE, SourceAddress( "OBG0_INP", "", RiaWellLogUnitTools::barUnitString() )}};
{{GRID, SourceAddress( "ST", "S33", RiaWellLogUnitTools<double>::barUnitString() )},
{LAS_FILE, SourceAddress( "OBG0_INP", "", RiaWellLogUnitTools<double>::barUnitString() )}};
return RigWbsParameter( "OBG0", true, sources );
}
@ -313,7 +317,7 @@ RigWbsParameter RigWbsParameter::OBG0()
RigWbsParameter RigWbsParameter::SH()
{
std::vector<std::pair<Source, SourceAddress>> sources = {
{GRID, SourceAddress( "ST", "S3", RiaWellLogUnitTools::barUnitString() )}};
{GRID, SourceAddress( "ST", "S3", RiaWellLogUnitTools<double>::barUnitString() )}};
return RigWbsParameter( "SH Input", true, sources );
}
@ -336,7 +340,7 @@ RigWbsParameter RigWbsParameter::K0_FG()
{
return RigWbsParameter( "K0_FG",
false,
{{LAS_FILE, SourceAddress( "K0_FG_INP", "", RiaWellLogUnitTools::sg_emwUnitString() )},
{{LAS_FILE, SourceAddress( "K0_FG_INP", "", RiaWellLogUnitTools<double>::sg_emwUnitString() )},
{ELEMENT_PROPERTY_TABLE, SourceAddress( "K0_FG_INP" )},
{USER_DEFINED, SourceAddress()}} );
}
@ -348,7 +352,7 @@ RigWbsParameter RigWbsParameter::K0_SH()
{
return RigWbsParameter( "K0_SH",
false,
{{LAS_FILE, SourceAddress( "K0_SH_INP", "", RiaWellLogUnitTools::sg_emwUnitString() )},
{{LAS_FILE, SourceAddress( "K0_SH_INP", "", RiaWellLogUnitTools<double>::sg_emwUnitString() )},
{ELEMENT_PROPERTY_TABLE, SourceAddress( "K0_SH_INP" )},
{USER_DEFINED, SourceAddress()}} );
}
@ -362,7 +366,8 @@ RigWbsParameter RigWbsParameter::FG_Shale()
false,
{{DERIVED_FROM_K0FG, SourceAddress()},
{PROPORTIONAL_TO_SH, SourceAddress()},
{LAS_FILE, SourceAddress( "FG_SHALE_INP", "", RiaWellLogUnitTools::sg_emwUnitString() )}} );
{LAS_FILE,
SourceAddress( "FG_SHALE_INP", "", RiaWellLogUnitTools<double>::sg_emwUnitString() )}} );
param.setOptionsExclusive( true );
return param;
}
@ -375,7 +380,7 @@ RigWbsParameter RigWbsParameter::waterDensity()
RigWbsParameter param( "Density of Sea Water",
false,
{{USER_DEFINED, SourceAddress()},
{LAS_FILE, SourceAddress( "RHO_INP", "", RiaWellLogUnitTools::gPerCm3UnitString() )}} );
{LAS_FILE, SourceAddress( "RHO_INP", "", RiaWellLogUnitTools<double>::gPerCm3UnitString() )}} );
return param;
}
//--------------------------------------------------------------------------------------------------

View File

@ -96,7 +96,9 @@ private:
QString primary; // i.e. grid field name, las entry, etc.
QString secondary; // i.e. grid component name
QString units; // The unit string
SourceAddress( QString primary = "", QString secondary = "", QString units = RiaWellLogUnitTools::noUnitString() )
SourceAddress( QString primary = "",
QString secondary = "",
QString units = RiaWellLogUnitTools<double>::noUnitString() )
: primary( primary )
, secondary( secondary )
, units( units )

View File

@ -35,7 +35,7 @@ RigWellLogCurveData::RigWellLogCurveData()
{
m_isExtractionCurve = false;
m_depthUnit = RiaDefines::UNIT_METER;
m_xUnitString = RiaWellLogUnitTools::noUnitString();
m_xUnitString = RiaWellLogUnitTools<double>::noUnitString();
}
//--------------------------------------------------------------------------------------------------
@ -117,11 +117,11 @@ std::vector<double> RigWellLogCurveData::xValues() const
std::vector<double> RigWellLogCurveData::xValues( const QString& units ) const
{
std::vector<double> convertedValues;
if ( units != m_xUnitString && RiaWellLogUnitTools::convertValues( depths( RiaDefines::TRUE_VERTICAL_DEPTH_RKB ),
m_xValues,
&convertedValues,
m_xUnitString,
units ) )
if ( units != m_xUnitString && RiaWellLogUnitTools<double>::convertValues( depths( RiaDefines::TRUE_VERTICAL_DEPTH_RKB ),
m_xValues,
&convertedValues,
m_xUnitString,
units ) )
{
return convertedValues;
}
@ -228,7 +228,7 @@ std::vector<double> RigWellLogCurveData::depthPlotValues( RiaDefines::DepthTypeE
else
{
std::vector<double> convertedValues =
RiaWellLogUnitTools().convertDepths( depthValues, m_depthUnit, destinationDepthUnit );
RiaWellLogUnitTools<double>::convertDepths( depthValues, m_depthUnit, destinationDepthUnit );
RiaCurveDataTools::getValuesByIntervals( convertedValues, m_intervalsOfContinousValidValues, &filteredValues );
}
}