From 803c9505b984f04f78bada717fdae1ad53bc4f8a Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Thu, 25 Aug 2022 14:44:52 +0200 Subject: [PATCH] Thermal Fracture: fix incorrect weighting when interpolating. --- .../ReservoirDataModel/RigThermalFractureResultUtil.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ReservoirDataModel/RigThermalFractureResultUtil.cpp b/ApplicationLibCode/ReservoirDataModel/RigThermalFractureResultUtil.cpp index 95a47237c3..b32af79043 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigThermalFractureResultUtil.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigThermalFractureResultUtil.cpp @@ -521,14 +521,14 @@ double RigThermalFractureResultUtil::interpolateProperty( const cvf::Vec3d& // Sort by distance std::sort( distances.begin(), distances.end() ); - // Create distance-weighthed mean of first few points + // Create inverse-distance-weighthed mean of first few points size_t numPoints = 3; RiaWeightedMeanCalculator calc; for ( size_t i = 0; i < numPoints; i++ ) { auto [distance, nodeIndex] = distances[i]; double value = fractureDefinition->getPropertyValue( propertyIndex, nodeIndex, static_cast( timeStepIndex ) ); - calc.addValueAndWeight( value, distance ); + calc.addValueAndWeight( value, std::pow( 1.0 / distance, 2.0 ) ); } return calc.weightedMean();