2017-02-07 02:09:00 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2017 - Statoil ASA
|
|
|
|
//
|
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RigStimPlanFractureDefinition.h"
|
|
|
|
|
2017-02-17 05:17:57 -06:00
|
|
|
#include <QDebug>
|
|
|
|
|
2017-02-20 02:31:24 -06:00
|
|
|
#include "cvfMath.h"
|
2017-06-12 07:30:18 -05:00
|
|
|
#include "RivWellFracturePartMgr.h"
|
2017-02-20 02:31:24 -06:00
|
|
|
|
2017-02-17 05:17:57 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-05-11 07:01:58 -05:00
|
|
|
RigStimPlanResultFrames::RigStimPlanResultFrames()
|
2017-02-17 05:17:57 -06:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-02-07 02:09:00 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-06-12 07:30:18 -05:00
|
|
|
RigStimPlanFractureDefinition::RigStimPlanFractureDefinition() : unitSet(RimUnitSystem::UNITS_UNKNOWN)
|
2017-02-07 02:09:00 -06:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigStimPlanFractureDefinition::~RigStimPlanFractureDefinition()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2017-02-15 03:32:34 -06:00
|
|
|
|
2017-06-12 07:30:18 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::vector<std::vector<double>> RigStimPlanFractureDefinition::getMirroredDataAtTimeIndex(const QString& resultName, const QString& unitName, size_t timeStepIndex) const
|
|
|
|
{
|
|
|
|
std::vector<std::vector<double>> notMirrordedData = this->getDataAtTimeIndex(resultName, unitName, timeStepIndex);
|
|
|
|
std::vector<std::vector<double>> mirroredData;
|
|
|
|
|
|
|
|
for ( std::vector<double> depthData : notMirrordedData )
|
|
|
|
{
|
|
|
|
std::vector<double> mirrordDepthData = RivWellFracturePartMgr::mirrorDataAtSingleDepth(depthData);
|
|
|
|
mirroredData.push_back(mirrordDepthData);
|
|
|
|
}
|
|
|
|
|
|
|
|
return mirroredData;
|
|
|
|
}
|
|
|
|
|
2017-02-15 03:32:34 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RigStimPlanFractureDefinition::timeStepExisist(double timeStepValueToCheck)
|
|
|
|
{
|
|
|
|
for (double timeStep : timeSteps)
|
|
|
|
{
|
|
|
|
if (abs(timeStepValueToCheck - timeStep) < 1e-5) return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RigStimPlanFractureDefinition::reorderYgridToDepths()
|
|
|
|
{
|
|
|
|
std::vector<double> depthsInIncreasingOrder;
|
|
|
|
for (double gridYvalue : gridYs)
|
|
|
|
{
|
|
|
|
depthsInIncreasingOrder.insert(depthsInIncreasingOrder.begin(), gridYvalue);
|
|
|
|
}
|
|
|
|
depths = depthsInIncreasingOrder;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
size_t RigStimPlanFractureDefinition::getTimeStepIndex(double timeStepValue)
|
|
|
|
{
|
|
|
|
size_t index = 0;
|
|
|
|
while (index < timeSteps.size())
|
|
|
|
{
|
|
|
|
if (abs(timeSteps[index] - timeStepValue) < 1e-4)
|
|
|
|
{
|
|
|
|
return index;
|
|
|
|
}
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
return -1; //returns -1 if not found
|
|
|
|
}
|
2017-02-17 02:29:46 -06:00
|
|
|
|
2017-02-17 05:17:57 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-03-02 04:43:28 -06:00
|
|
|
size_t RigStimPlanFractureDefinition::totalNumberTimeSteps()
|
|
|
|
{
|
|
|
|
return timeSteps.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-02-20 02:31:24 -06:00
|
|
|
size_t RigStimPlanFractureDefinition::resultIndex(const QString& resultName, const QString& unit) const
|
2017-02-17 05:17:57 -06:00
|
|
|
{
|
2017-02-20 02:31:24 -06:00
|
|
|
|
|
|
|
for (size_t i = 0; i < stimPlanData.size(); i++)
|
2017-02-17 05:17:57 -06:00
|
|
|
{
|
2017-02-20 02:31:24 -06:00
|
|
|
if (stimPlanData[i].resultName == resultName && stimPlanData[i].unit == unit)
|
2017-02-17 05:17:57 -06:00
|
|
|
{
|
2017-02-20 02:31:24 -06:00
|
|
|
return i;
|
2017-02-17 05:17:57 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-20 02:31:24 -06:00
|
|
|
return cvf::UNDEFINED_SIZE_T;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RigStimPlanFractureDefinition::setDataAtTimeValue(QString resultName, QString unit, std::vector<std::vector<double>> data, double timeStepValue)
|
|
|
|
{
|
|
|
|
size_t resIndex = resultIndex(resultName, unit);
|
|
|
|
|
|
|
|
if (resIndex != cvf::UNDEFINED_SIZE_T)
|
|
|
|
{
|
|
|
|
stimPlanData[resIndex].parameterValues[getTimeStepIndex(timeStepValue)] = data;
|
|
|
|
}
|
|
|
|
else
|
2017-02-17 05:17:57 -06:00
|
|
|
{
|
2017-05-11 07:01:58 -05:00
|
|
|
RigStimPlanResultFrames resultData;
|
2017-02-17 05:17:57 -06:00
|
|
|
|
|
|
|
resultData.resultName = resultName;
|
|
|
|
resultData.unit = unit;
|
|
|
|
|
|
|
|
std::vector<std::vector<std::vector<double>>> values(timeSteps.size());
|
|
|
|
resultData.parameterValues = values;
|
|
|
|
resultData.parameterValues[getTimeStepIndex(timeStepValue)] = data;
|
|
|
|
|
|
|
|
stimPlanData.push_back(resultData);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-02-20 02:31:24 -06:00
|
|
|
std::vector<std::vector<double>> RigStimPlanFractureDefinition::getDataAtTimeIndex(const QString& resultName, const QString& unit, size_t timeStepIndex) const
|
2017-02-17 05:17:57 -06:00
|
|
|
{
|
2017-02-20 02:31:24 -06:00
|
|
|
size_t resIndex = resultIndex(resultName, unit);
|
|
|
|
|
|
|
|
if (resIndex != cvf::UNDEFINED_SIZE_T)
|
2017-02-17 05:17:57 -06:00
|
|
|
{
|
2017-02-20 03:04:21 -06:00
|
|
|
if (timeStepIndex < stimPlanData[resIndex].parameterValues.size())
|
|
|
|
{
|
|
|
|
return stimPlanData[resIndex].parameterValues[timeStepIndex];
|
|
|
|
}
|
2017-02-17 05:17:57 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
qDebug() << "ERROR: Requested parameter does not exists in stimPlan data";
|
|
|
|
std::vector<std::vector<double>> emptyVector;
|
|
|
|
return emptyVector;
|
|
|
|
}
|
|
|
|
|
2017-02-20 02:31:24 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RigStimPlanFractureDefinition::computeMinMax(const QString& resultName, const QString& unit, double* minValue, double* maxValue) const
|
|
|
|
{
|
|
|
|
CVF_ASSERT(minValue && maxValue);
|
|
|
|
|
|
|
|
size_t resIndex = resultIndex(resultName, unit);
|
|
|
|
if (resIndex == cvf::UNDEFINED_SIZE_T) return;
|
|
|
|
|
|
|
|
for (auto timeValues : stimPlanData[resIndex].parameterValues)
|
|
|
|
{
|
|
|
|
for (auto values : timeValues)
|
|
|
|
{
|
|
|
|
for (auto resultValue : values)
|
|
|
|
{
|
|
|
|
if (resultValue < *minValue)
|
|
|
|
{
|
|
|
|
*minValue = resultValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (resultValue > *maxValue)
|
|
|
|
{
|
|
|
|
*maxValue = resultValue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|