#3953 Extend well completions spec

This commit is contained in:
Gaute Lindkvist
2019-01-29 10:05:57 +01:00
parent fde60d1e34
commit 7a50fa12f8
8 changed files with 330 additions and 47 deletions

View File

@@ -24,37 +24,12 @@
#include "cafPdmUiDoubleValueEditor.h"
#include "cafPdmUiGroup.h"
#include "cafPdmUiLineEditor.h"
#include <QDoubleValidator>
#include "cafPdmDoubleStringValidator.h"
#include <limits>
CAF_PDM_SOURCE_INIT(RimWellPathAicdParameters, "WellPathAicdParameters");
class NumericStringValidator : public QDoubleValidator
{
public:
NumericStringValidator(const QString& defaultValue)
: m_defaultValue(defaultValue), QDoubleValidator(nullptr)
{}
void fixup(QString& input) const override
{
input = m_defaultValue;
}
State validate(QString& input, int& pos) const override
{
if (input == m_defaultValue)
{
return QValidator::Acceptable;
}
return QDoubleValidator::validate(input, pos);
}
private:
QString m_defaultValue;
};
//--------------------------------------------------------------------------------------------------
///
@@ -133,7 +108,7 @@ std::array<double, AICD_NUM_PARAMS> RimWellPathAicdParameters::doubleValues() co
std::array<double, AICD_NUM_PARAMS> doubleValues;
for (int i = 0; i < (int)AICD_NUM_PARAMS; ++i)
{
NumericStringValidator validator(nullptr);
caf::PdmDoubleStringValidator validator(nullptr);
QString stringValue = m_aicdParameterFields[(AICDParameters)i].value();
bool ok = true;
double doubleValue = stringValue.toDouble(&ok);
@@ -186,11 +161,11 @@ void RimWellPathAicdParameters::defineEditorAttribute(const caf::PdmFieldHandle*
{
if (stringFieldsWithNoValidDefault().count(stringField))
{
lineEditorAttr->validator = new NumericStringValidator("");
lineEditorAttr->validator = new caf::PdmDoubleStringValidator("");
}
else
{
lineEditorAttr->validator = new NumericStringValidator("1*");
lineEditorAttr->validator = new caf::PdmDoubleStringValidator("1*");
}
}
}

View File

@@ -32,6 +32,8 @@
#include "cvfAssert.h"
#include "cafPdmDoubleStringValidator.h"
#include "cafPdmUiDoubleValueEditor.h"
#include "cafPdmUiLineEditor.h"
#include "cafPdmUiTreeOrdering.h"
@@ -56,7 +58,37 @@ namespace caf {
setDefault(RimWellPathCompletions::OIL);
}
}
template<>
void RimWellPathCompletions::GasInflowEnum::setUp()
{
addItem(RimWellPathCompletions::STANDARD_EQ, "STD", "Standard");
addItem(RimWellPathCompletions::RUSSELL_GOODRICH, "R-G", "Russell-Goodrich");
addItem(RimWellPathCompletions::DRY_GAS_PSEUDO_PRESSURE, "P-P", "Dry Gas Pseudo-Pressure");
addItem(RimWellPathCompletions::GENERALIZED_PSEUDO_PRESSURE, "GPP", "Generalized Pseudo-Pressure");
setDefault(RimWellPathCompletions::STANDARD_EQ);
}
template<>
void RimWellPathCompletions::AutomaticWellShutInEnum::setUp()
{
addItem(RimWellPathCompletions::ISOLATE_FROM_FORMATION, "SHUT", "Isolate from Formation");
addItem(RimWellPathCompletions::STOP_ABOVE_FORMATION, "STOP", "Stop above Formation");
setDefault(RimWellPathCompletions::STOP_ABOVE_FORMATION);
}
template<>
void RimWellPathCompletions::HydrostaticDensityEnum::setUp()
{
addItem(RimWellPathCompletions::SEGMENTED, "SEG", "Segmented");
addItem(RimWellPathCompletions::AVERAGED, "AVG", "Averaged");
setDefault(RimWellPathCompletions::SEGMENTED);
}
}
CAF_PDM_SOURCE_INIT(RimWellPathCompletions, "WellPathCompletions");
@@ -80,14 +112,19 @@ RimWellPathCompletions::RimWellPathCompletions()
m_fractureCollection = new RimWellPathFractureCollection;
m_fractureCollection.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&m_wellNameForExport, "WellNameForExport", QString(), "Well Name for Completion Export", "", "", "");
CAF_PDM_InitField(&m_wellNameForExport, "WellNameForExport", QString(), "Well Name", "", "", "");
m_wellNameForExport.uiCapability()->setUiEditorTypeName(caf::PdmUiLineEditor::uiEditorTypeName());
CAF_PDM_InitField(&m_wellGroupName, "WellGroupNameForExport", QString(), "Well Group Name for Completion Export", "", "", "");
CAF_PDM_InitField(&m_referenceDepth, "ReferenceDepthForExport", QString(), "Reference Depth for Completion Export", "", "", "");
CAF_PDM_InitField(&m_wellType, "WellTypeForExport", WellTypeEnum(), "Well Type for Completion Export", "", "", "");
CAF_PDM_InitField(&m_wellGroupName, "WellGroupNameForExport", QString(), "Well Group Name", "", "", "");
CAF_PDM_InitField(&m_referenceDepth, "ReferenceDepthForExport", QString(), "Reference Depth for BHP", "", "", "");
CAF_PDM_InitField(&m_preferredFluidPhase, "WellTypeForExport", WellTypeEnum(), "Preferred Fluid Phase", "", "", "");
CAF_PDM_InitField(&m_drainageRadiusForPI, "DrainageRadiusForPI", QString("0.0"), "Drainage Radius for PI", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_gasInflowEquation, "GasInflowEq", "Gas Inflow Equation", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_automaticWellShutIn, "AutoWellShutIn", "Automatic well shut-in", "", "", "");
CAF_PDM_InitField(&m_allowWellCrossFlow, "AllowWellCrossFlow", true, "Allow Well Cross-Flow", "", "", "");
CAF_PDM_InitField(&m_wellBoreFluidPVTTable, "WellBoreFluidPVTTable", 0, "Wellbore Fluid PVT table", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_hydrostaticDensity, "HydrostaticDensity", "Hydrostatic Density", "", "", "");
CAF_PDM_InitField(&m_fluidInPlaceRegion, "FluidInPlaceRegion", 0, "Fluid In-Place Region", "", "", "");
}
//--------------------------------------------------------------------------------------------------
@@ -153,7 +190,7 @@ QString RimWellPathCompletions::referenceDepthForExport() const
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletions::wellTypeNameForExport() const
{
switch (m_wellType.v())
switch (m_preferredFluidPhase.v())
{
case OIL: return "OIL";
case GAS: return "GAS";
@@ -227,6 +264,62 @@ bool RimWellPathCompletions::hasCompletions() const
!perforationCollection()->perforations().empty();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletions::drainageRadiusForExport() const
{
return m_drainageRadiusForPI();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletions::gasInflowEquationForExport() const
{
return m_gasInflowEquation().text();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletions::automaticWellShutInForExport() const
{
return m_automaticWellShutIn().text();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletions::allowWellCrossFlowForExport() const
{
return m_allowWellCrossFlow() ? "YES" : "NO";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletions::wellBoreFluidPVTForExport() const
{
return QString("%1").arg(m_wellBoreFluidPVTTable());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletions::hydrostaticDensityForExport() const
{
return m_hydrostaticDensity().text();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletions::fluidInPlaceRegionForExport() const
{
return QString("%1").arg(m_fluidInPlaceRegion());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -246,6 +339,26 @@ QRegExp RimWellPathCompletions::wellNameForExportRegExp()
return rx;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletions::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
caf::PdmUiGroup* compExportGroup = uiOrdering.addNewGroup("Completion Export Parameters");
compExportGroup->add(&m_wellNameForExport);
compExportGroup->add(&m_wellGroupName);
compExportGroup->add(&m_referenceDepth);
compExportGroup->add(&m_preferredFluidPhase);
compExportGroup->add(&m_drainageRadiusForPI);
compExportGroup->add(&m_gasInflowEquation);
compExportGroup->add(&m_automaticWellShutIn);
compExportGroup->add(&m_allowWellCrossFlow);
compExportGroup->add(&m_wellBoreFluidPVTTable);
compExportGroup->add(&m_hydrostaticDensity);
compExportGroup->add(&m_fluidInPlaceRegion);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -308,6 +421,24 @@ void RimWellPathCompletions::defineEditorAttribute(const caf::PdmFieldHandle* fi
validator->setRegExp(wellNameForExportRegExp());
lineEditorAttr->validator = validator;
}
else if (field == &m_drainageRadiusForPI && lineEditorAttr)
{
caf::PdmDoubleStringValidator* validator = new caf::PdmDoubleStringValidator("1*");
lineEditorAttr->validator = validator;
}
else if (field == &m_wellBoreFluidPVTTable && lineEditorAttr)
{
// Positive integer
QIntValidator* validator = new QIntValidator(0, std::numeric_limits<int>::max(), nullptr);
lineEditorAttr->validator = validator;
}
else if (field == &m_fluidInPlaceRegion && lineEditorAttr)
{
// Any integer
QIntValidator* validator = new QIntValidator(-std::numeric_limits<int>::max(), std::numeric_limits<int>::max(), nullptr);
lineEditorAttr->validator = validator;
}
}
//--------------------------------------------------------------------------------------------------

View File

@@ -39,6 +39,15 @@ class RimWellPathCompletions : public caf::PdmObject
enum WellType {OIL, GAS, WATER, LIQUID};
typedef caf::AppEnum<WellType> WellTypeEnum;
enum GasInflowEquation {STANDARD_EQ, RUSSELL_GOODRICH, DRY_GAS_PSEUDO_PRESSURE, GENERALIZED_PSEUDO_PRESSURE };
typedef caf::AppEnum<GasInflowEquation> GasInflowEnum;
enum AutomaticWellShutIn {ISOLATE_FROM_FORMATION, STOP_ABOVE_FORMATION };
typedef caf::AppEnum<AutomaticWellShutIn> AutomaticWellShutInEnum;
enum HydrostaticDensity { SEGMENTED, AVERAGED };
typedef caf::AppEnum<HydrostaticDensity> HydrostaticDensityEnum;
public:
RimWellPathCompletions();
@@ -56,9 +65,18 @@ public:
QString wellTypeNameForExport() const;
bool hasCompletions() const;
QString drainageRadiusForExport() const;
QString gasInflowEquationForExport() const;
QString automaticWellShutInForExport() const;
QString allowWellCrossFlowForExport() const;
QString wellBoreFluidPVTForExport() const;
QString hydrostaticDensityForExport() const;
QString fluidInPlaceRegionForExport() const;
void setUnitSystemSpecificDefaults();
static QRegExp wellNameForExportRegExp();
protected:
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) override;
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override;
@@ -75,5 +93,12 @@ private:
caf::PdmField<QString> m_wellGroupName;
caf::PdmField<QString> m_referenceDepth;
caf::PdmField<WellTypeEnum> m_wellType;
caf::PdmField<WellTypeEnum> m_preferredFluidPhase;
caf::PdmField<QString> m_drainageRadiusForPI;
caf::PdmField<GasInflowEnum> m_gasInflowEquation;
caf::PdmField<AutomaticWellShutInEnum> m_automaticWellShutIn;
caf::PdmField<bool> m_allowWellCrossFlow;
caf::PdmField<int> m_wellBoreFluidPVTTable;
caf::PdmField<HydrostaticDensityEnum> m_hydrostaticDensity;
caf::PdmField<int> m_fluidInPlaceRegion;
};