#9102 Thermal Fracture: handle field units.

This commit is contained in:
Kristian Bendiksen
2022-09-15 08:19:41 +02:00
committed by Magne Sjaastad
parent d2d6e61271
commit 49bfc62ea7
7 changed files with 70 additions and 16 deletions
@@ -27,6 +27,7 @@
///
//--------------------------------------------------------------------------------------------------
RigThermalFractureDefinition::RigThermalFractureDefinition()
: m_unitSystem( RiaDefines::EclipseUnitSystem::UNITS_UNKNOWN )
{
}
@@ -53,6 +54,22 @@ QString RigThermalFractureDefinition::name() const
return m_name;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigThermalFractureDefinition::setUnitSystem( RiaDefines::EclipseUnitSystem unitSystem )
{
m_unitSystem = unitSystem;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaDefines::EclipseUnitSystem RigThermalFractureDefinition::unitSystem() const
{
return m_unitSystem;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -58,9 +58,14 @@ public:
std::vector<cvf::Vec3d> relativeCoordinates( int timeStepIndex ) const;
void setUnitSystem( RiaDefines::EclipseUnitSystem unitSystem );
RiaDefines::EclipseUnitSystem unitSystem() const;
private:
QString m_name;
RiaDefines::EclipseUnitSystem m_unitSystem;
std::vector<double> m_timeSteps;
std::vector<RigThermalFractureResult> m_results;
};
@@ -18,6 +18,7 @@
#include "RigThermalFractureResultUtil.h"
#include "RiaEclipseUnitTools.h"
#include "RiaLogging.h"
#include "RiaWeightedMeanCalculator.h"
@@ -256,6 +257,30 @@ cvf::cref<RigFractureGrid>
return nullptr;
}
// Check that the data is in the required unit system.
// Convert if not the case.
if ( requiredUnitSet != fractureDefinition->unitSystem() )
{
// Convert to the conductivity unit system used by the fracture template
// The conductivity value is used in the computations of transmissibility when exporting COMPDAT, and has unit
// md-m or md-ft This unit must match the unit used to represent coordinates of the grid used for export
for ( auto& yValues : conductivityValues )
{
for ( auto& xVal : yValues )
{
if ( requiredUnitSet == RiaDefines::EclipseUnitSystem::UNITS_FIELD )
{
xVal = RiaEclipseUnitTools::convertToFeet( xVal, conductivityUnitTextOnFile, false );
}
else if ( requiredUnitSet == RiaDefines::EclipseUnitSystem::UNITS_METRIC )
{
xVal = RiaEclipseUnitTools::convertToMeter( xVal, conductivityUnitTextOnFile, false );
}
}
}
}
// Create bounding box
cvf::BoundingBox boundingBox;
for ( auto p : points )