#2494 Add height/width fracture scaling

This commit is contained in:
Bjørn Erik Jensen
2018-03-01 14:16:08 +01:00
parent 4f20c7862e
commit 2ac9aba485
8 changed files with 97 additions and 11 deletions

View File

@@ -39,6 +39,9 @@ bool hasNegativeValues(std::vector<double> xs);
//--------------------------------------------------------------------------------------------------
cvf::ref<RigStimPlanFractureDefinition> RifStimPlanXmlReader::readStimPlanXMLFile(const QString& stimPlanFileName,
double conductivityScalingFactor,
double xScaleFactor,
double yScaleFactor,
double wellPathInterationY,
MirrorMode mirrorMode,
RiaEclipseUnitTools::UnitSystem requiredUnit,
QString * errorMessage)
@@ -59,6 +62,9 @@ cvf::ref<RigStimPlanFractureDefinition> RifStimPlanXmlReader::readStimPlanXMLFil
xmlStream.readNext();
readStimplanGridAndTimesteps(xmlStream, stimPlanFileData.p(), mirrorMode, requiredUnit);
if(xScaleFactor != 1.0) stimPlanFileData->scaleXs(xScaleFactor);
if(yScaleFactor != 1.0) stimPlanFileData->scaleYs(yScaleFactor, wellPathInterationY);
RiaEclipseUnitTools::UnitSystemType unitSystem = stimPlanFileData->unitSet();
if (unitSystem != RiaEclipseUnitTools::UNITS_UNKNOWN)

View File

@@ -37,6 +37,9 @@ public:
static cvf::ref<RigStimPlanFractureDefinition> readStimPlanXMLFile(const QString& stimPlanFileName,
double conductivityScalingFactor,
double xScaleFactor,
double yScaleFactor,
double wellPathIntersectionY,
MirrorMode mirrorMode,
RiaEclipseUnitTools::UnitSystem requiredUnit,
QString * errorMessage);

View File

@@ -90,7 +90,8 @@ void RimEllipseFractureTemplate::fieldChangedByUi(const caf::PdmFieldHandle* cha
if ( changedField == &m_halfLength
|| changedField == &m_height
|| changedField == &m_width
|| changedField == &m_userDefinedEffectivePermeability)
|| changedField == &m_userDefinedEffectivePermeability
|| changedField == &m_sizeScaleApplyButton)
{
//Changes to one of these parameters should change all fractures with this fracture template attached.
RimProject* proj;
@@ -116,8 +117,8 @@ void RimEllipseFractureTemplate::fractureTriangleGeometry(std::vector<cvf::Vec3f
{
RigEllipsisTesselator tesselator(20);
float a = m_halfLength;
float b = m_height / 2.0f;
float a = m_halfLength * m_widthScaleFactor;
float b = m_height / 2.0f * m_heightScaleFactor;
tesselator.tesselateEllipsis(a, b, triangleIndices, nodeCoords);
}
@@ -164,15 +165,17 @@ void RimEllipseFractureTemplate::changeUnits()
//--------------------------------------------------------------------------------------------------
void RimEllipseFractureTemplate::setupFractureGridCells()
{
std::vector<RigFractureCell> fractureCells;
std::pair<size_t, size_t> wellCenterFractureCellIJ = std::make_pair(0, 0);
int numberOfCellsX = 35;
int numberOfCellsY = 35;
double cellSizeX = (m_halfLength * 2) / numberOfCellsX;
double cellSizeZ = m_height / numberOfCellsY;
double height = m_height * m_heightScaleFactor;
double halfLength = m_halfLength * m_widthScaleFactor;
double cellSizeX = (halfLength * 2) / numberOfCellsX * m_widthScaleFactor;
double cellSizeZ = height / numberOfCellsY * m_heightScaleFactor;
double cellArea = cellSizeX * cellSizeZ;
double areaTresholdForIncludingCell = 0.5 * cellArea;
@@ -182,10 +185,10 @@ void RimEllipseFractureTemplate::setupFractureGridCells()
{
for (int j = 0; j < numberOfCellsX; j++)
{
double X1 = - m_halfLength + i * cellSizeX;
double X2 = - m_halfLength + (i+1) * cellSizeX;
double Y1 = - m_height / 2 + j * cellSizeZ;
double Y2 = - m_height / 2 + (j+1) * cellSizeZ;
double X1 = - halfLength + i * cellSizeX;
double X2 = - halfLength + (i+1) * cellSizeX;
double Y1 = - height / 2 + j * cellSizeZ;
double Y2 = - height / 2 + (j+1) * cellSizeZ;
std::vector<cvf::Vec3d> cellPolygon;
cellPolygon.push_back(cvf::Vec3d(X1, Y1, 0.0));

View File

@@ -29,6 +29,7 @@
#include "cafPdmUiDoubleSliderEditor.h"
#include "cafPdmUiDoubleValueEditor.h"
#include "cafPdmUiTextEditor.h"
#include "cafPdmUiPushButtonEditor.h"
#include "cvfVector3.h"
@@ -153,6 +154,13 @@ RimFractureTemplate::RimFractureTemplate()
m_dFactorSummaryText.uiCapability()->setUiEditorTypeName(caf::PdmUiTextEditor::uiEditorTypeName());
m_dFactorSummaryText.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::LabelPosType::TOP);
m_dFactorSummaryText.xmlCapability()->disableIO();
CAF_PDM_InitField(&m_heightScaleFactor, "HeightScaleFactor", 1.0, "Height Scale Factor", "", "", "");
CAF_PDM_InitField(&m_widthScaleFactor, "WidthScaleFactor", 1.0, "Width Scale Factor", "", "", "");
CAF_PDM_InitField(&m_sizeScaleApplyButton, "SizeScaleApplyButton", false, "Apply", "", "", "");
m_sizeScaleApplyButton.xmlCapability()->disableIO();
m_sizeScaleApplyButton.uiCapability()->setUiEditorTypeName(caf::PdmUiPushButtonEditor::uiEditorTypeName());
m_sizeScaleApplyButton.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
}
//--------------------------------------------------------------------------------------------------
@@ -296,6 +304,14 @@ void RimFractureTemplate::defineUiOrdering(QString uiConfigName, caf::PdmUiOrder
{
prepareFieldsForUiDisplay();
{
auto group = uiOrdering.addNewGroup("Scale Factors");
group->setCollapsedByDefault(false);
group->add(&m_heightScaleFactor);
group->add(&m_widthScaleFactor);
group->add(&m_sizeScaleApplyButton);
}
auto nonDarcyFlowGroup = uiOrdering.addNewGroup("Non-Darcy Flow");
nonDarcyFlowGroup->add(&m_nonDarcyFlowType);
@@ -363,6 +379,15 @@ void RimFractureTemplate::defineEditorAttribute(const caf::PdmFieldHandle* field
myAttr->textMode = caf::PdmUiTextEditorAttribute::HTML;
}
}
if (field == &m_sizeScaleApplyButton)
{
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute);
if (attrib)
{
attrib->m_buttonText = "Apply";
}
}
}
//--------------------------------------------------------------------------------------------------

View File

@@ -190,4 +190,8 @@ protected:
caf::PdmProxyValueField<double> m_dFactorDisplayField;
caf::PdmProxyValueField<QString> m_dFactorSummaryText;
caf::PdmField<double> m_heightScaleFactor;
caf::PdmField<double> m_widthScaleFactor;
caf::PdmField<bool> m_sizeScaleApplyButton;
};

View File

@@ -151,6 +151,22 @@ void RimStimPlanFractureTemplate::fieldChangedByUi(const caf::PdmFieldHandle* ch
proj->createDisplayModelAndRedrawAllViews();
}
}
if (changedField == &m_sizeScaleApplyButton)
{
m_sizeScaleApplyButton = false;
loadDataAndUpdate();
//setDefaultsBasedOnXMLfile();
updateFractureGrid();
RimProject* proj;
this->firstAncestorOrThisOfType(proj);
if (proj)
{
proj->createDisplayModelAndRedrawAllViews();
}
}
}
//--------------------------------------------------------------------------------------------------
@@ -241,6 +257,9 @@ void RimStimPlanFractureTemplate::loadDataAndUpdate()
m_stimPlanFractureDefinitionData = RifStimPlanXmlReader::readStimPlanXMLFile( m_stimPlanFileName(),
m_conductivityScalingFactor(),
m_widthScaleFactor(),
m_heightScaleFactor(),
-m_wellPathDepthAtFracture(),
RifStimPlanXmlReader::MIRROR_AUTO,
fractureTemplateUnit(),
&errorMessage);

View File

@@ -130,6 +130,30 @@ double RigStimPlanFractureDefinition::maxY() const
return m_Ys.back();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigStimPlanFractureDefinition::scaleXs(double scaleFactor)
{
// Scale using 0 as scaling anchor
for (double& x : m_Xs)
{
x *= scaleFactor;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigStimPlanFractureDefinition::scaleYs(double scaleFactor, double wellPathIntersectionY)
{
// Scale using wellPathIntersectionY as scaling anchor
for (double& y : m_Ys)
{
y = (y - wellPathIntersectionY) * scaleFactor + wellPathIntersectionY;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -121,6 +121,8 @@ private:
bool numberOfParameterValuesOK(std::vector<std::vector<double>> propertyValuesAtTimestep);
double minY() const;
double maxY() const;
void scaleXs(double scaleFactor);
void scaleYs(double scaleFactor, double wellPathIntersectionY);
private:
RiaEclipseUnitTools::UnitSystem m_unitSet; // To be deleted