mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1138 - pre-proto - Code cleanup and adding slider for well depth in stimplan file
This commit is contained in:
parent
1b99c25297
commit
359f8f9726
@ -25,6 +25,7 @@
|
|||||||
#include "RimStimPlanLegendConfig.h"
|
#include "RimStimPlanLegendConfig.h"
|
||||||
|
|
||||||
#include "cafPdmObject.h"
|
#include "cafPdmObject.h"
|
||||||
|
#include "cafPdmUiDoubleSliderEditor.h"
|
||||||
#include "cafPdmUiFilePathEditor.h"
|
#include "cafPdmUiFilePathEditor.h"
|
||||||
|
|
||||||
#include "cvfVector3.h"
|
#include "cvfVector3.h"
|
||||||
@ -50,6 +51,7 @@ RimStimPlanFractureTemplate::RimStimPlanFractureTemplate(void)
|
|||||||
m_stimPlanFileName.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
m_stimPlanFileName.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||||
|
|
||||||
CAF_PDM_InitField(&wellPathDepthAtFracture, "WellPathDepthAtFracture", 0.0, "Depth of Well Path at Fracture", "", "", "");
|
CAF_PDM_InitField(&wellPathDepthAtFracture, "WellPathDepthAtFracture", 0.0, "Depth of Well Path at Fracture", "", "", "");
|
||||||
|
wellPathDepthAtFracture.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault(&m_legendConfigurations, "LegendConfigurations", "", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_legendConfigurations, "LegendConfigurations", "", "", "", "");
|
||||||
m_legendConfigurations.uiCapability()->setUiTreeHidden(true);
|
m_legendConfigurations.uiCapability()->setUiTreeHidden(true);
|
||||||
@ -240,6 +242,7 @@ void RimStimPlanFractureTemplate::readStimPlanXMLFile(QString * errorMessage)
|
|||||||
qDebug() << dataFile.errorString();
|
qDebug() << dataFile.errorString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setDepthOfWellPathAtFracture();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -401,6 +404,20 @@ bool RimStimPlanFractureTemplate::numberOfParameterValuesOK(std::vector<std::vec
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimStimPlanFractureTemplate::setDepthOfWellPathAtFracture()
|
||||||
|
{
|
||||||
|
if (!m_stimPlanFractureDefinitionData.isNull())
|
||||||
|
{
|
||||||
|
double firstDepth = m_stimPlanFractureDefinitionData->depths[0];
|
||||||
|
double lastDepth = m_stimPlanFractureDefinitionData->depths[m_stimPlanFractureDefinitionData->depths.size()-1];
|
||||||
|
double averageDepth = (firstDepth + lastDepth) / 2;
|
||||||
|
wellPathDepthAtFracture = averageDepth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -567,78 +584,54 @@ std::vector<std::pair<QString, QString> > RimStimPlanFractureTemplate::getStimPl
|
|||||||
return propertyNamesUnits;
|
return propertyNamesUnits;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
std::vector<std::vector<double>> RimStimPlanFractureTemplate::getConductivitiesAtTimeStep(size_t timStep)
|
|
||||||
{
|
|
||||||
return m_stimPlanFractureDefinitionData->getDataAtTimeIndex("CONDUCTIVITY", timStep);
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
std::vector<std::vector<double>> RimStimPlanFractureTemplate::getPermeabilitiesAtTimeStep(size_t timStep)
|
|
||||||
{
|
|
||||||
return m_stimPlanFractureDefinitionData->getDataAtTimeIndex("PERMEABILITY", timStep);
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
std::vector<std::vector<double>> RimStimPlanFractureTemplate::getWidthsAtTimeStep(size_t timStep)
|
|
||||||
{
|
|
||||||
return m_stimPlanFractureDefinitionData->getDataAtTimeIndex("WIDTH", timStep);
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<cvf::Vec3f> RimStimPlanFractureTemplate::fracturePolygon()
|
std::vector<cvf::Vec3f> RimStimPlanFractureTemplate::fracturePolygon()
|
||||||
{
|
{
|
||||||
std::vector<cvf::Vec3f> polygon;
|
std::vector<cvf::Vec3f> polygon;
|
||||||
|
|
||||||
//TODO: Handle multiple time-step and properties
|
//TODO: Handle multiple time-step and properties
|
||||||
std::vector<std::vector<double>> ConductivitiesAtTimeStep = m_stimPlanFractureDefinitionData->conductivities[0];
|
std::vector<std::vector<double>> dataAtTimeStep = m_stimPlanFractureDefinitionData->getDataAtTimeIndex(getStimPlanPropertyNamesUnits()[0].first, 0);
|
||||||
|
|
||||||
for (int k = 0; k < ConductivitiesAtTimeStep.size(); k++)
|
for (int k = 0; k < dataAtTimeStep.size(); k++)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < ConductivitiesAtTimeStep[k].size(); i++)
|
for (int i = 0; i < dataAtTimeStep[k].size(); i++)
|
||||||
{
|
{
|
||||||
if ((ConductivitiesAtTimeStep[k])[i] > 1e-7)
|
if ((dataAtTimeStep[k])[i] > 1e-7)
|
||||||
{
|
{
|
||||||
if ((i < ConductivitiesAtTimeStep[k].size() - 1))
|
if ((i < dataAtTimeStep[k].size() - 1))
|
||||||
{
|
{
|
||||||
if ((ConductivitiesAtTimeStep[k])[(i + 1)] < 1e-7)
|
if ((dataAtTimeStep[k])[(i + 1)] < 1e-7)
|
||||||
{
|
{
|
||||||
polygon.push_back(cvf::Vec3f(static_cast<float>(m_stimPlanFractureDefinitionData->gridXs[i]),
|
polygon.push_back(cvf::Vec3f(static_cast<float>(m_stimPlanFractureDefinitionData->gridXs[i]),
|
||||||
static_cast<float>(m_stimPlanFractureDefinitionData->depths[k]), 0.0f));
|
static_cast<float>(m_stimPlanFractureDefinitionData->depths[k]), 0.0f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
polygon.push_back(cvf::Vec3f(static_cast<float>(m_stimPlanFractureDefinitionData->gridXs[i]),
|
polygon.push_back(cvf::Vec3f(static_cast<float>(m_stimPlanFractureDefinitionData->gridXs[i]),
|
||||||
static_cast<float>(m_stimPlanFractureDefinitionData->depths[k]), 0.0f));
|
static_cast<float>(m_stimPlanFractureDefinitionData->depths[k]), 0.0f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<cvf::Vec3f> negPolygon;
|
std::vector<cvf::Vec3f> negPolygon;
|
||||||
|
|
||||||
for (const auto& node : polygon)
|
for (const auto& node : polygon)
|
||||||
{
|
{
|
||||||
cvf::Vec3f negNode = node;
|
cvf::Vec3f negNode = node;
|
||||||
negNode.x() = -negNode.x();
|
negNode.x() = -negNode.x();
|
||||||
negPolygon.insert(negPolygon.begin(), negNode);
|
negPolygon.insert(negPolygon.begin(), negNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& negNode : negPolygon)
|
for (const auto& negNode : negPolygon)
|
||||||
{
|
{
|
||||||
polygon.push_back(negNode);
|
polygon.push_back(negNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
return polygon;
|
return polygon;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -652,6 +645,7 @@ void RimStimPlanFractureTemplate::defineUiOrdering(QString uiConfigName, caf::Pd
|
|||||||
|
|
||||||
caf::PdmUiGroup* fileGroup = uiOrdering.addNewGroup("File");
|
caf::PdmUiGroup* fileGroup = uiOrdering.addNewGroup("File");
|
||||||
fileGroup->add(&m_stimPlanFileName);
|
fileGroup->add(&m_stimPlanFileName);
|
||||||
|
fileGroup->add(&wellPathDepthAtFracture);
|
||||||
|
|
||||||
caf::PdmUiGroup* geometryGroup = uiOrdering.addNewGroup("Fracture geometry");
|
caf::PdmUiGroup* geometryGroup = uiOrdering.addNewGroup("Fracture geometry");
|
||||||
geometryGroup->add(&orientation);
|
geometryGroup->add(&orientation);
|
||||||
@ -662,3 +656,23 @@ void RimStimPlanFractureTemplate::defineUiOrdering(QString uiConfigName, caf::Pd
|
|||||||
propertyGroup->add(&skinFactor);
|
propertyGroup->add(&skinFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimStimPlanFractureTemplate::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute)
|
||||||
|
{
|
||||||
|
if (field == &wellPathDepthAtFracture)
|
||||||
|
{
|
||||||
|
if (!m_stimPlanFractureDefinitionData.isNull())
|
||||||
|
{
|
||||||
|
caf::PdmUiDoubleSliderEditorAttribute* myAttr = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>(attribute);
|
||||||
|
if (myAttr)
|
||||||
|
{
|
||||||
|
myAttr->m_minimum = m_stimPlanFractureDefinitionData->depths[0];
|
||||||
|
myAttr->m_maximum = m_stimPlanFractureDefinitionData->depths[m_stimPlanFractureDefinitionData->depths.size()-1];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -64,17 +64,13 @@ public:
|
|||||||
std::vector<double> getStimPlanTimeValues();
|
std::vector<double> getStimPlanTimeValues();
|
||||||
std::vector<std::pair<QString, QString> > getStimPlanPropertyNamesUnits();
|
std::vector<std::pair<QString, QString> > getStimPlanPropertyNamesUnits();
|
||||||
|
|
||||||
|
|
||||||
//TODO: Remove!!!
|
|
||||||
std::vector<std::vector<double>> getConductivitiesAtTimeStep(size_t timStep);
|
|
||||||
std::vector<std::vector<double>> getPermeabilitiesAtTimeStep(size_t timStep);
|
|
||||||
std::vector<std::vector<double>> getWidthsAtTimeStep(size_t timStep);
|
|
||||||
|
|
||||||
void loadDataAndUpdate();
|
void loadDataAndUpdate();
|
||||||
|
|
||||||
std::vector<std::vector<double>> getDataAtTimeIndex(QString resultName, size_t timeStepIndex);
|
std::vector<std::vector<double>> getDataAtTimeIndex(QString resultName, size_t timeStepIndex);
|
||||||
protected:
|
protected:
|
||||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
|
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
|
||||||
|
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute) override;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateUiTreeName();
|
void updateUiTreeName();
|
||||||
@ -96,4 +92,5 @@ private:
|
|||||||
caf::PdmChildArrayField<RimStimPlanLegendConfig*> m_legendConfigurations;
|
caf::PdmChildArrayField<RimStimPlanLegendConfig*> m_legendConfigurations;
|
||||||
|
|
||||||
bool numberOfParameterValuesOK(std::vector<std::vector<double>> propertyValuesAtTimestep);
|
bool numberOfParameterValuesOK(std::vector<std::vector<double>> propertyValuesAtTimestep);
|
||||||
|
void setDepthOfWellPathAtFracture();
|
||||||
};
|
};
|
||||||
|
@ -32,6 +32,7 @@ public:
|
|||||||
QString resultName;
|
QString resultName;
|
||||||
QString unit;
|
QString unit;
|
||||||
std::vector<std::vector<std::vector<double>>> parameterValues;
|
std::vector<std::vector<std::vector<double>>> parameterValues;
|
||||||
|
//Vector for each time step, for each depth and for each x-value
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -51,13 +52,6 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
std::vector<RigStimPlanData> stimPlanData;
|
std::vector<RigStimPlanData> stimPlanData;
|
||||||
//Vector for each time step, for each depth and for each x-value
|
|
||||||
std::vector<std::vector<std::vector<double>>> conductivities;
|
|
||||||
QString conductivityUnit;
|
|
||||||
std::vector<std::vector<std::vector<double>>> widths;
|
|
||||||
QString widthUnit;
|
|
||||||
std::vector<std::vector<std::vector<double>>> permeabilities;
|
|
||||||
QString permeabilityUnit;
|
|
||||||
|
|
||||||
bool timeStepExisist(double timeStepValue);
|
bool timeStepExisist(double timeStepValue);
|
||||||
void reorderYgridToDepths();
|
void reorderYgridToDepths();
|
||||||
|
Loading…
Reference in New Issue
Block a user