diff --git a/ApplicationCode/FileInterface/RifStimPlanXmlReader.cpp b/ApplicationCode/FileInterface/RifStimPlanXmlReader.cpp index a57fdf986a..edff203d97 100644 --- a/ApplicationCode/FileInterface/RifStimPlanXmlReader.cpp +++ b/ApplicationCode/FileInterface/RifStimPlanXmlReader.cpp @@ -38,7 +38,10 @@ bool hasNegativeValues(std::vector xs); /// //-------------------------------------------------------------------------------------------------- cvf::ref RifStimPlanXmlReader::readStimPlanXMLFile(const QString& stimPlanFileName, - double conductivityScalingFactor, + double conductivityScalingFactor, + double xScaleFactor, + double yScaleFactor, + double wellPathInterationY, MirrorMode mirrorMode, RiaEclipseUnitTools::UnitSystem requiredUnit, QString * errorMessage) @@ -59,6 +62,9 @@ cvf::ref 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) diff --git a/ApplicationCode/FileInterface/RifStimPlanXmlReader.h b/ApplicationCode/FileInterface/RifStimPlanXmlReader.h index b698b1e62e..3489930d2e 100644 --- a/ApplicationCode/FileInterface/RifStimPlanXmlReader.h +++ b/ApplicationCode/FileInterface/RifStimPlanXmlReader.h @@ -37,6 +37,9 @@ public: static cvf::ref readStimPlanXMLFile(const QString& stimPlanFileName, double conductivityScalingFactor, + double xScaleFactor, + double yScaleFactor, + double wellPathIntersectionY, MirrorMode mirrorMode, RiaEclipseUnitTools::UnitSystem requiredUnit, QString * errorMessage); diff --git a/ApplicationCode/ProjectDataModel/Completions/RimEllipseFractureTemplate.cpp b/ApplicationCode/ProjectDataModel/Completions/RimEllipseFractureTemplate.cpp index cd9137ae5c..38a0adeba5 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimEllipseFractureTemplate.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimEllipseFractureTemplate.cpp @@ -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 fractureCells; std::pair 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 cellPolygon; cellPolygon.push_back(cvf::Vec3d(X1, Y1, 0.0)); diff --git a/ApplicationCode/ProjectDataModel/Completions/RimFractureTemplate.cpp b/ApplicationCode/ProjectDataModel/Completions/RimFractureTemplate.cpp index 2a767abdb9..822224a258 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimFractureTemplate.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimFractureTemplate.cpp @@ -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 (attribute); + if (attrib) + { + attrib->m_buttonText = "Apply"; + } + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Completions/RimFractureTemplate.h b/ApplicationCode/ProjectDataModel/Completions/RimFractureTemplate.h index 8f43d92cf2..0a8b2db880 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimFractureTemplate.h +++ b/ApplicationCode/ProjectDataModel/Completions/RimFractureTemplate.h @@ -190,4 +190,8 @@ protected: caf::PdmProxyValueField m_dFactorDisplayField; caf::PdmProxyValueField m_dFactorSummaryText; + + caf::PdmField m_heightScaleFactor; + caf::PdmField m_widthScaleFactor; + caf::PdmField m_sizeScaleApplyButton; }; diff --git a/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp b/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp index 9080a881e0..7075042138 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp @@ -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); diff --git a/ApplicationCode/ReservoirDataModel/RigStimPlanFractureDefinition.cpp b/ApplicationCode/ReservoirDataModel/RigStimPlanFractureDefinition.cpp index 9accb428d6..d69b6c575d 100644 --- a/ApplicationCode/ReservoirDataModel/RigStimPlanFractureDefinition.cpp +++ b/ApplicationCode/ReservoirDataModel/RigStimPlanFractureDefinition.cpp @@ -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; + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ReservoirDataModel/RigStimPlanFractureDefinition.h b/ApplicationCode/ReservoirDataModel/RigStimPlanFractureDefinition.h index b496548b45..9aad1cf12c 100644 --- a/ApplicationCode/ReservoirDataModel/RigStimPlanFractureDefinition.h +++ b/ApplicationCode/ReservoirDataModel/RigStimPlanFractureDefinition.h @@ -121,6 +121,8 @@ private: bool numberOfParameterValuesOK(std::vector> 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