Make mean calculators more consistent and add an harmonic mean calculator.

This commit is contained in:
Gaute Lindkvist
2018-09-14 09:12:05 +02:00
parent 6f42d6ae1f
commit 9953c56c35
12 changed files with 224 additions and 36 deletions

View File

@@ -32,7 +32,7 @@
#include "RigResultAccessorFactory.h"
#include "RigTransmissibilityCondenser.h"
#include "RiaWeightedAverageCalculator.h"
#include "RiaWeightedMeanCalculator.h"
#include "RimEclipseCase.h"
#include "RimEllipseFractureTemplate.h"
#include "RimFracture.h"
@@ -146,7 +146,7 @@ double RigEclipseToStimPlanCalculator::totalEclipseAreaOpenForFlow() const
//--------------------------------------------------------------------------------------------------
double RigEclipseToStimPlanCalculator::areaWeightedMatrixTransmissibility() const
{
RiaWeightedAverageCalculator<double> calc;
RiaWeightedMeanCalculator<double> calc;
for (const auto& singleCellCalc : m_singleFractureCellCalculators)
{
@@ -155,7 +155,7 @@ double RigEclipseToStimPlanCalculator::areaWeightedMatrixTransmissibility() cons
calc.addValueAndWeight(calulator.aggregatedMatrixTransmissibility(), calulator.areaOpenForFlow());
}
return calc.weightedAverage();
return calc.weightedMean();
}
//--------------------------------------------------------------------------------------------------
@@ -174,7 +174,7 @@ double RigEclipseToStimPlanCalculator::areaWeightedWidth() const
auto stimPlanFractureTemplate = dynamic_cast<const RimStimPlanFractureTemplate*>(m_fracture->fractureTemplate());
if (stimPlanFractureTemplate)
{
RiaWeightedAverageCalculator<double> calc;
RiaWeightedMeanCalculator<double> calc;
auto widthValues = stimPlanFractureTemplate->widthResultValues();
@@ -188,7 +188,7 @@ double RigEclipseToStimPlanCalculator::areaWeightedWidth() const
calc.addValueAndWeight(widthValue, cellArea);
}
width = calc.weightedAverage();
width = calc.weightedMean();
}
return width;
@@ -199,7 +199,7 @@ double RigEclipseToStimPlanCalculator::areaWeightedWidth() const
//--------------------------------------------------------------------------------------------------
double RigEclipseToStimPlanCalculator::areaWeightedConductivity() const
{
RiaWeightedAverageCalculator<double> calc;
RiaWeightedMeanCalculator<double> calc;
for (const auto& singleCellCalc : m_singleFractureCellCalculators)
{
@@ -208,7 +208,7 @@ double RigEclipseToStimPlanCalculator::areaWeightedConductivity() const
calc.addValueAndWeight(singleCellCalc.second.fractureCell().getConductivityValue(), cellArea);
}
return calc.weightedAverage();
return calc.weightedMean();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -23,7 +23,7 @@
#include "RigGeoMechWellLogExtractor.h"
#include "RiaDefines.h"
#include "RiaWeightedAverageCalculator.h"
#include "RiaWeightedMeanCalculator.h"
#include "RigFemTypes.h"
#include "RigGeoMechBoreHoleStressCalculator.h"
#include "RigFemPart.h"
@@ -316,7 +316,7 @@ void RigGeoMechWellLogExtractor::wellPathScaledCurveData(const RigFemResultAddre
float averageUnscaledValue = std::numeric_limits<float>::infinity();
bool validAverage = averageIntersectionValuesToSegmentValue(intersectionIdx, interpolatedInterfaceValues, std::numeric_limits<float>::infinity(), &averageUnscaledValue);
if (resAddr.fieldName == "PP")
if (resAddr.fieldName == "PP" && validAverage)
{
double segmentPorePressureFromGrid = averageUnscaledValue;
averageUnscaledValue = calculatePorePressureInSegment(intersectionIdx, segmentPorePressureFromGrid, hydroStaticPorePressureBar, effectiveDepthMeters, poreElementPressuresPascal);
@@ -776,7 +776,7 @@ double RigGeoMechWellLogExtractor::getWellLogSegmentValue(size_t intersectionIdx
endMD = m_intersectionMeasuredDepths[intersectionIdx];
}
RiaWeightedAverageCalculator<double> averageCalc;
RiaWeightedMeanCalculator<double> averageCalc;
for (auto& depthAndValue : wellLogValues)
{
if (cvf::Math::valueInRange(depthAndValue.first, startMD, endMD))
@@ -794,7 +794,7 @@ double RigGeoMechWellLogExtractor::getWellLogSegmentValue(size_t intersectionIdx
}
if (averageCalc.validAggregatedWeight())
{
return averageCalc.weightedAverage();
return averageCalc.weightedMean();
}
return std::numeric_limits<double>::infinity();
@@ -842,12 +842,12 @@ bool RigGeoMechWellLogExtractor::averageIntersectionValuesToSegmentValue(size_t
return false;
}
RiaWeightedAverageCalculator<T> averageCalc;
RiaWeightedMeanCalculator<T> averageCalc;
averageCalc.addValueAndWeight(value1, dist2);
averageCalc.addValueAndWeight(value2, dist1);
if (averageCalc.validAggregatedWeight())
{
*averagedCellValue = averageCalc.weightedAverage();
*averagedCellValue = averageCalc.weightedMean();
}
return true;
}