Merge fracture unit refactoring into dev #2509

Add display of M and F in front of fracture templates
Add convert of StimPlan templates
Add copy/paste of StimPlan templates
Remove obsolete unit conversion code
This commit is contained in:
Magne Sjaastad
2018-02-21 10:12:48 +01:00
32 changed files with 778 additions and 329 deletions

View File

@@ -133,59 +133,17 @@ double RigStimPlanFractureDefinition::maxY() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigStimPlanFractureDefinition::setTvdToTopPerf(double topPerfTvd, RiaDefines::DepthUnitType unit)
void RigStimPlanFractureDefinition::setTvdToTopPerf(double topPerfTvd)
{
if (unit == RiaDefines::UNIT_METER)
{
if (m_unitSet == RiaEclipseUnitTools::UNITS_FIELD)
{
m_topPerfTvd = RiaEclipseUnitTools::meterToFeet(topPerfTvd);
}
else if (m_unitSet == RiaEclipseUnitTools::UNITS_METRIC)
{
m_topPerfTvd = topPerfTvd;
}
}
else if (unit == RiaDefines::UNIT_FEET)
{
if (m_unitSet == RiaEclipseUnitTools::UNITS_FIELD)
{
m_topPerfTvd = topPerfTvd;
}
else if (m_unitSet == RiaEclipseUnitTools::UNITS_METRIC)
{
m_topPerfTvd = RiaEclipseUnitTools::feetToMeter(topPerfTvd);
}
}
m_topPerfTvd = topPerfTvd;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigStimPlanFractureDefinition::setTvdToBottomPerf(double bottomPerfTvd, RiaDefines::DepthUnitType unit)
void RigStimPlanFractureDefinition::setTvdToBottomPerf(double bottomPerfTvd)
{
if (unit == RiaDefines::UNIT_METER)
{
if (m_unitSet == RiaEclipseUnitTools::UNITS_FIELD)
{
m_bottomPerfTvd = RiaEclipseUnitTools::meterToFeet(bottomPerfTvd);
}
else if (m_unitSet == RiaEclipseUnitTools::UNITS_METRIC)
{
m_bottomPerfTvd = bottomPerfTvd;
}
}
else if (unit == RiaDefines::UNIT_FEET)
{
if (m_unitSet == RiaEclipseUnitTools::UNITS_FIELD)
{
m_bottomPerfTvd = bottomPerfTvd;
}
else if (m_unitSet == RiaEclipseUnitTools::UNITS_METRIC)
{
m_bottomPerfTvd = RiaEclipseUnitTools::feetToMeter(bottomPerfTvd);
}
}
m_bottomPerfTvd = bottomPerfTvd;
}
//--------------------------------------------------------------------------------------------------
@@ -298,7 +256,7 @@ std::vector<std::pair<QString, QString> > RigStimPlanFractureDefinition::getStim
//--------------------------------------------------------------------------------------------------
cvf::ref<RigFractureGrid> RigStimPlanFractureDefinition::createFractureGrid(const QString& resultName,
int activeTimeStepIndex,
RiaEclipseUnitTools::UnitSystemType fractureTemplateUnit,
const QString& conductivityUnitText,
double wellPathIntersectionAtFractureDepth)
{
std::vector<RigFractureCell> stimPlanCells;
@@ -306,10 +264,8 @@ cvf::ref<RigFractureGrid> RigStimPlanFractureDefinition::createFractureGrid(cons
bool wellCenterStimPlanCellFound = false;
QString condUnit = RiaDefines::unitStringConductivity(fractureTemplateUnit);
std::vector<std::vector<double>> conductivityValuesAtTimeStep = this->getDataAtTimeIndex(resultName,
condUnit,
conductivityUnitText,
activeTimeStepIndex);
std::vector<double> yCoordsAtNodes = this->adjustedYCoordsAroundWellPathPosition(wellPathIntersectionAtFractureDepth);
@@ -407,7 +363,6 @@ std::vector<double> RigStimPlanFractureDefinition::fractureGridResults(const QSt
///
//--------------------------------------------------------------------------------------------------
void RigStimPlanFractureDefinition::createFractureTriangleGeometry(double wellPathIntersectionAtFractureDepth,
RiaEclipseUnitTools::UnitSystem neededUnit,
const QString& fractureUserName,
std::vector<cvf::Vec3f>* vertices,
std::vector<cvf::uint>* triangleIndices)
@@ -417,30 +372,6 @@ void RigStimPlanFractureDefinition::createFractureTriangleGeometry(double wellPa
std::vector<double> adjustedYs = this->adjustedYCoordsAroundWellPathPosition(wellPathIntersectionAtFractureDepth);
if ( neededUnit == m_unitSet )
{
RiaLogging::debug(QString("No conversion necessary for %1").arg(fractureUserName));
}
else if ( m_unitSet == RiaEclipseUnitTools::UNITS_METRIC && neededUnit == RiaEclipseUnitTools::UNITS_FIELD )
{
RiaLogging::info(QString("Converting StimPlan geometry from metric to field for fracture template %1").arg(fractureUserName));
for ( double& value : adjustedYs ) value = RiaEclipseUnitTools::meterToFeet(value);
for ( double& value : xCoords ) value = RiaEclipseUnitTools::meterToFeet(value);
}
else if ( m_unitSet == RiaEclipseUnitTools::UNITS_FIELD && neededUnit == RiaEclipseUnitTools::UNITS_METRIC )
{
RiaLogging::info(QString("Converting StimPlan geometry from field to metric for fracture template %1").arg(fractureUserName));
for ( double& value : adjustedYs ) value = RiaEclipseUnitTools::feetToMeter(value);
for ( double& value : xCoords ) value = RiaEclipseUnitTools::feetToMeter(value);
}
else
{
//Should never get here...
RiaLogging::error(QString("Error: Could not convert units for fracture template %1").arg(fractureUserName));
return;
}
for ( cvf::uint k = 0; k < adjustedYs.size(); k++ )
{
for ( cvf::uint i = 0; i < lenXcoords; i++ )
@@ -473,7 +404,6 @@ void RigStimPlanFractureDefinition::createFractureTriangleGeometry(double wellPa
triangleIndices->push_back((i + 1) + (k + 1)*lenXcoords);
triangleIndices->push_back((i)+ (k + 1)*lenXcoords);
}
}
}
}
@@ -516,7 +446,6 @@ std::vector<cvf::Vec3f> RigStimPlanFractureDefinition::createFractureBorderPolyg
const QString& resultUnit,
int activeTimeStepIndex,
double wellPathIntersectionAtFractureDepth,
RiaEclipseUnitTools::UnitSystem neededUnit,
const QString& fractureUserName)
{
std::vector<cvf::Vec3f> polygon;
@@ -568,41 +497,6 @@ std::vector<cvf::Vec3f> RigStimPlanFractureDefinition::createFractureBorderPolyg
//Adding first point last - to close the polygon
if ( polygon.size()>0 ) polygon.push_back(polygon[0]);
if ( neededUnit == m_unitSet )
{
RiaLogging::debug(QString("No conversion necessary for %1").arg(fractureUserName));
}
else if ( m_unitSet == RiaEclipseUnitTools::UNITS_METRIC && neededUnit == RiaEclipseUnitTools::UNITS_FIELD )
{
RiaLogging::info(QString("Converting StimPlan geometry from metric to field for fracture template %1").arg(fractureUserName));
for ( cvf::Vec3f& node : polygon )
{
float x = RiaEclipseUnitTools::meterToFeet(node.x());
float y = RiaEclipseUnitTools::meterToFeet(node.y());
float z = RiaEclipseUnitTools::meterToFeet(node.z());
node = cvf::Vec3f(x, y, z);
}
}
else if ( m_unitSet == RiaEclipseUnitTools::UNITS_FIELD && neededUnit == RiaEclipseUnitTools::UNITS_METRIC )
{
RiaLogging::info(QString("Converting StimPlan geometry from field to metric for fracture template %1").arg(fractureUserName));
for ( cvf::Vec3f& node : polygon )
{
float x = RiaEclipseUnitTools::feetToMeter(node.x());
float y = RiaEclipseUnitTools::feetToMeter(node.y());
float z = RiaEclipseUnitTools::feetToMeter(node.z());
node = cvf::Vec3f(x, y, z);
}
}
else
{
//Should never get here...
RiaLogging::error(QString("Error: Could not convert units for fracture template %1").arg(fractureUserName));
}
return polygon;
}

View File

@@ -68,16 +68,15 @@ public:
double maxDepth() const;
double topPerfTvd() const;
double bottomPerfTvd() const;
void setTvdToTopPerf(double topPerfTvd, RiaDefines::DepthUnitType unit);
void setTvdToBottomPerf(double bottomPerfTvd, RiaDefines::DepthUnitType unit);
void setTvdToTopPerf(double topPerfTvd);
void setTvdToBottomPerf(double bottomPerfTvd);
cvf::ref<RigFractureGrid> createFractureGrid(const QString& resultName,
int activeTimeStepIndex,
RiaEclipseUnitTools::UnitSystemType fractureTemplateUnit,
const QString& conductivityUnitText,
double wellPathIntersectionAtFractureDepth);
void createFractureTriangleGeometry(double wellPathIntersectionAtFractureDepth,
RiaEclipseUnitTools::UnitSystem neededUnit,
const QString& fractureUserName,
std::vector<cvf::Vec3f>* vertices,
std::vector<cvf::uint>* triangleIndices);
@@ -86,7 +85,6 @@ public:
const QString& resultUnit,
int activeTimeStepIndex,
double wellPathIntersectionAtFractureDepth,
RiaEclipseUnitTools::UnitSystem neededUnit,
const QString& fractureUserName);
const std::vector<double>& timeSteps() const;
@@ -125,7 +123,7 @@ private:
double maxY() const;
private:
RiaEclipseUnitTools::UnitSystem m_unitSet;
RiaEclipseUnitTools::UnitSystem m_unitSet; // To be deleted
std::vector<double> m_fileXs;
std::vector<double> m_Ys;
std::vector<double> m_timeSteps;