Merge branch 'dev' into pre-proto

This commit is contained in:
Bjørnar Grip Fjær 2017-06-20 13:26:52 +02:00
commit 7c99a2573a
47 changed files with 1460 additions and 395 deletions

View File

@ -985,18 +985,7 @@ bool RiaApplication::openEclipseCase(const QString& caseName, const QString& cas
{
if (rimResultReservoir->eclipseCaseData())
{
if (rimResultReservoir->eclipseCaseData()->unitsType() == RigEclipseCaseData::UNITS_METRIC)
{
project()->activeOilField()->fractureDefinitionCollection->defaultUnitsForFracTemplates = RiaEclipseUnitTools::UNITS_METRIC;
}
else if (rimResultReservoir->eclipseCaseData()->unitsType() == RigEclipseCaseData::UNITS_FIELD)
{
project()->activeOilField()->fractureDefinitionCollection->defaultUnitsForFracTemplates = RiaEclipseUnitTools::UNITS_FIELD;
}
else if (rimResultReservoir->eclipseCaseData()->unitsType() == RigEclipseCaseData::UNITS_LAB)
{
project()->activeOilField()->fractureDefinitionCollection->defaultUnitsForFracTemplates = RiaEclipseUnitTools::UNITS_METRIC;
}
project()->activeOilField()->fractureDefinitionCollection->defaultUnitsForFracTemplates = rimResultReservoir->eclipseCaseData()->unitsType();
}
}

View File

@ -28,7 +28,7 @@ public:
{
UNITS_METRIC,
UNITS_FIELD,
//UNITS_LAB, // Not yet
UNITS_LAB,
UNITS_UNKNOWN,
};

View File

@ -31,8 +31,8 @@ RicCaseAndFileExportSettingsUi::RicCaseAndFileExportSettingsUi()
{
CAF_PDM_InitObject("RimCaseAndFileExportSettings", "", "", "");
CAF_PDM_InitFieldNoDefault(&fileName, "Filename", "Export Filename", "", "", "");
fileName.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
CAF_PDM_InitFieldNoDefault(&folder, "Folder", "Export Folder", "", "", "");
folder.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
CAF_PDM_InitFieldNoDefault(&caseToApply, "CaseToApply", "Case to Apply", "", "", "");
}
@ -57,12 +57,12 @@ QList<caf::PdmOptionItemInfo> RicCaseAndFileExportSettingsUi::calculateValueOpti
//--------------------------------------------------------------------------------------------------
void RicCaseAndFileExportSettingsUi::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
{
if (field == &fileName)
if (field == &folder)
{
caf::PdmUiFilePathEditorAttribute* myAttr = static_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
if (myAttr)
{
myAttr->m_selectSaveFileName = true;
myAttr->m_selectDirectory = true;
}
}
}

View File

@ -35,7 +35,7 @@ public:
RicCaseAndFileExportSettingsUi();
caf::PdmField<QString> fileName;
caf::PdmField<QString> folder;
caf::PdmPtrField<RimEclipseCase*> caseToApply;
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;

View File

@ -18,6 +18,27 @@
#include "RicExportCompletionDataSettingsUi.h"
namespace caf
{
template<>
void RicExportCompletionDataSettingsUi::ExportSplitType::setUp()
{
addItem(RicExportCompletionDataSettingsUi::UNIFIED_FILE, "UNIFIED_FILE", "Unified File");
addItem(RicExportCompletionDataSettingsUi::SPLIT_ON_WELL, "SPLIT_ON_WELL", "Split on Well");
addItem(RicExportCompletionDataSettingsUi::SPLIT_ON_WELL_AND_COMPLETION_TYPE, "SPLIT_ON_WELL_AND_COMPLETION_TYPE", "Split on Well and Completion Type");
setDefault(RicExportCompletionDataSettingsUi::UNIFIED_FILE);
}
template<>
void RicExportCompletionDataSettingsUi::WellSelectionType::setUp()
{
addItem(RicExportCompletionDataSettingsUi::ALL_WELLS, "ALL_WELLS", "All Wells");
addItem(RicExportCompletionDataSettingsUi::CHECKED_WELLS, "CHECKED_WELLS", "Checked Wells");
setDefault(RicExportCompletionDataSettingsUi::ALL_WELLS);
}
}
CAF_PDM_SOURCE_INIT(RicExportCompletionDataSettingsUi, "RicExportCompletionDataSettingsUi");
//--------------------------------------------------------------------------------------------------
@ -27,6 +48,9 @@ RicExportCompletionDataSettingsUi::RicExportCompletionDataSettingsUi()
{
CAF_PDM_InitObject("RimExportCompletionDataSettings", "", "", "");
CAF_PDM_InitFieldNoDefault(&fileSplit, "FileSplit", "File Split", "", "", "");
CAF_PDM_InitFieldNoDefault(&wellSelection, "WellSelection", "Well Selection", "", "", "");
CAF_PDM_InitField(&timeStep, "TimeStepIndex", 0, "Time Step", "", "", "");
CAF_PDM_InitField(&computeTransmissibility, "ComputeTransmissibility", true, "Compute Transmissibility", "", "", "");
@ -37,7 +61,6 @@ RicExportCompletionDataSettingsUi::RicExportCompletionDataSettingsUi()
CAF_PDM_InitField(&includeWpimult, "IncludeWPIMULT", true, "Include WPIMLUT", "", "", "");
CAF_PDM_InitField(&removeLateralsInMainBoreCells, "RemoveLateralsInMainBoreCells", false, "Remove Laterals in Main Bore Cells", "", "", "");
}
//--------------------------------------------------------------------------------------------------
@ -88,7 +111,7 @@ QList<caf::PdmOptionItemInfo> RicExportCompletionDataSettingsUi::calculateValueO
//--------------------------------------------------------------------------------------------------
void RicExportCompletionDataSettingsUi::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
uiOrdering.add(&fileName);
uiOrdering.add(&folder);
uiOrdering.add(&caseToApply);
uiOrdering.add(&timeStep);
uiOrdering.add(&computeTransmissibility);

View File

@ -21,6 +21,7 @@
#include "RicCaseAndFileExportSettingsUi.h"
#include "cafPdmField.h"
#include "cafAppEnum.h"
//==================================================================================================
///
@ -30,9 +31,26 @@ class RicExportCompletionDataSettingsUi : public RicCaseAndFileExportSettingsUi
{
CAF_PDM_HEADER_INIT;
public:
enum ExportSplit {
UNIFIED_FILE,
SPLIT_ON_WELL,
SPLIT_ON_WELL_AND_COMPLETION_TYPE,
};
typedef caf::AppEnum<ExportSplit> ExportSplitType;
enum WellSelection {
ALL_WELLS,
CHECKED_WELLS,
};
typedef caf::AppEnum<WellSelection> WellSelectionType;
RicExportCompletionDataSettingsUi();
caf::PdmField<ExportSplitType> fileSplit;
caf::PdmField<WellSelectionType> wellSelection;
caf::PdmField<bool> computeTransmissibility;
caf::PdmField<bool> includePerforations;
caf::PdmField<bool> includeFishbones;

View File

@ -74,12 +74,12 @@ void RicExportFishbonesWellSegmentsFeature::onActionTriggered(bool isChecked)
}
}
exportSettings.fileName = QDir(defaultDir).filePath("WellSegments");
exportSettings.folder = defaultDir;
caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export Completion Data", "");
if (propertyDialog.exec() == QDialog::Accepted)
{
RiaApplication::instance()->setLastUsedDialogDirectory("COMPLETIONS", QFileInfo(exportSettings.fileName).absolutePath());
RiaApplication::instance()->setLastUsedDialogDirectory("COMPLETIONS", QFileInfo(exportSettings.folder).absolutePath());
std::vector<RimFishbonesMultipleSubs*> fishbonesSubs;
for (RimFishbonesMultipleSubs* subs : fishbonesCollection->fishbonesSubs)
@ -153,7 +153,8 @@ bool RicExportFishbonesWellSegmentsFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicExportFishbonesWellSegmentsFeature::exportWellSegments(const RimWellPath* wellPath, const std::vector<RimFishbonesMultipleSubs*>& fishbonesSubs, const RicExportWellSegmentsSettingsUi& settings)
{
QFile exportFile(settings.fileName());
QString filePath = QDir(settings.folder()).filePath("Welsegs");
QFile exportFile(filePath);
if (settings.caseToApply() == nullptr)
{
@ -163,7 +164,7 @@ void RicExportFishbonesWellSegmentsFeature::exportWellSegments(const RimWellPath
if (!exportFile.open(QIODevice::WriteOnly))
{
RiaLogging::error(QString("Export Well Segments: Could not open the file: %1").arg(settings.fileName()));
RiaLogging::error(QString("Export Well Segments: Could not open the file: %1").arg(filePath));
return;
}
@ -184,6 +185,8 @@ void RicExportFishbonesWellSegmentsFeature::generateWelsegsTable(RifEclipseDataT
const RicExportWellSegmentsSettingsUi& settings,
const std::vector<WellSegmentLocation>& locations)
{
RiaEclipseUnitTools::UnitSystem unitSystem = settings.caseToApply->eclipseCaseData()->unitsType();
formatter.keyword("WELSEGS");
double startMD = wellPath->fishbonesCollection()->startMD();
@ -245,7 +248,8 @@ void RicExportFishbonesWellSegmentsFeature::generateWelsegsTable(RifEclipseDataT
length += location.fishbonesSubs->measuredDepth(location.subIndex) - previousMD;
}
double diameter = computeEffectiveDiameter(wellPath->fishbonesCollection()->linerDiameter(), wellPath->fishbonesCollection()->mainBoreDiameter());
double diameter = computeEffectiveDiameter(wellPath->fishbonesCollection()->linerDiameter(unitSystem),
wellPath->fishbonesCollection()->mainBoreDiameter(unitSystem));
formatter.comment(QString("Segment for sub %1").arg(location.subIndex));
formatter.add(location.segmentNumber).add(location.segmentNumber);
@ -254,7 +258,7 @@ void RicExportFishbonesWellSegmentsFeature::generateWelsegsTable(RifEclipseDataT
formatter.add(length);
formatter.add(depth);
formatter.add(diameter);
formatter.add(wellPath->fishbonesCollection()->roughnessFactor());
formatter.add(wellPath->fishbonesCollection()->roughnessFactor(unitSystem));
formatter.rowCompleted();
previousMD = location.measuredDepth;
@ -268,7 +272,8 @@ void RicExportFishbonesWellSegmentsFeature::generateWelsegsTable(RifEclipseDataT
formatter.comment("Rough: MSW - Open Hole Roughness Factor");
for (const WellSegmentLocation& location : locations)
{
double diameter = computeEffectiveDiameter(wellPath->fishbonesCollection()->linerDiameter(), wellPath->fishbonesCollection()->mainBoreDiameter());
double diameter = computeEffectiveDiameter(wellPath->fishbonesCollection()->linerDiameter(unitSystem),
wellPath->fishbonesCollection()->mainBoreDiameter(unitSystem));
formatter.comment("ICD");
formatter.add(location.icdSegmentNumber).add(location.icdSegmentNumber);
formatter.add(location.icdBranchNumber);
@ -276,7 +281,7 @@ void RicExportFishbonesWellSegmentsFeature::generateWelsegsTable(RifEclipseDataT
formatter.add(0.1); // ICDs have 0.1 length
formatter.add(0); // Depth change
formatter.add(diameter);
formatter.add(wellPath->fishbonesCollection()->roughnessFactor());
formatter.add(wellPath->fishbonesCollection()->roughnessFactor(unitSystem));
formatter.rowCompleted();
for (const WellSegmentLateral& lateral : location.laterals)
@ -298,7 +303,7 @@ void RicExportFishbonesWellSegmentsFeature::generateWelsegsTable(RifEclipseDataT
depth += intersection.depth;
length += intersection.length;
}
double diameter = computeEffectiveDiameter(location.fishbonesSubs->tubingDiameter(), location.fishbonesSubs->holeDiameter());
double diameter = computeEffectiveDiameter(location.fishbonesSubs->tubingDiameter(unitSystem), location.fishbonesSubs->holeDiameter(unitSystem));
formatter.add(intersection.segmentNumber);
formatter.add(intersection.segmentNumber);
formatter.add(lateral.branchNumber);
@ -306,7 +311,7 @@ void RicExportFishbonesWellSegmentsFeature::generateWelsegsTable(RifEclipseDataT
formatter.add(length);
formatter.add(depth);
formatter.add(diameter);
formatter.add(location.fishbonesSubs->openHoleRoughnessFactor());
formatter.add(location.fishbonesSubs->openHoleRoughnessFactor(unitSystem));
formatter.rowCompleted();
}
}
@ -382,6 +387,8 @@ void RicExportFishbonesWellSegmentsFeature::generateWsegvalvTable(RifEclipseData
const RicExportWellSegmentsSettingsUi& settings,
const std::vector<WellSegmentLocation>& locations)
{
RiaEclipseUnitTools::UnitSystem unitSystem = settings.caseToApply->eclipseCaseData()->unitsType();
{
formatter.keyword("WSEGVALV");
std::vector<RifEclipseOutputTableColumn> header = {
@ -398,7 +405,7 @@ void RicExportFishbonesWellSegmentsFeature::generateWsegvalvTable(RifEclipseData
formatter.add(location.icdSegmentNumber);
formatter.add(location.fishbonesSubs->icdFlowCoefficient());
double icdOrificeRadius = location.fishbonesSubs->icdOrificeDiameter() / 2;
double icdOrificeRadius = location.fishbonesSubs->icdOrificeDiameter(unitSystem) / 2;
double icdArea = icdOrificeRadius * icdOrificeRadius * cvf::PI_D;
formatter.add(icdArea * static_cast<double>(location.fishbonesSubs->icdCount()));
formatter.rowCompleted();

View File

@ -108,7 +108,7 @@ std::vector<RigCompletionData> RicExportFractureCompletionsImpl::generateCompdat
const std::vector<RimFracture*> fractures,
QTextStream* outputStreamForIntermediateResultsText)
{
double cDarcyInCorrectUnit = caseToApply->eclipseCaseData()->darchysValue();
double cDarcyInCorrectUnit = RiaEclipseUnitTools::darcysConstant(caseToApply->eclipseCaseData()->unitsType());
const RigMainGrid* mainGrid = caseToApply->eclipseCaseData()->mainGrid();
// To handle several fractures in the same eclipse cell we need to keep track of the transmissibility

View File

@ -31,61 +31,6 @@
#include "RimFishboneWellPathCollection.h"
#include "RimWellPathCompletions.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RigCompletionData> RicFishbonesTransmissibilityCalculationFeatureImp::generateFishboneLateralsCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings)
{
// Generate data
const RigEclipseCaseData* caseData = settings.caseToApply()->eclipseCaseData();
std::vector<WellSegmentLocation> locations = RicWellPathExportCompletionDataFeature::findWellSegmentLocations(settings.caseToApply, wellPath);
// Filter out cells where main bore is present
if (settings.removeLateralsInMainBoreCells())
{
std::vector<size_t> wellPathCells = RicWellPathExportCompletionDataFeature::findIntersectingCells(caseData, wellPath->wellPathGeometry()->m_wellPathPoints);
RicWellPathExportCompletionDataFeature::markWellPathCells(wellPathCells, &locations);
}
RigMainGrid* grid = settings.caseToApply->eclipseCaseData()->mainGrid();
std::vector<RigCompletionData> completionData;
for (const WellSegmentLocation& location : locations)
{
for (const WellSegmentLateral& lateral : location.laterals)
{
for (const WellSegmentLateralIntersection& intersection : lateral.intersections)
{
if (intersection.mainBoreCell && settings.removeLateralsInMainBoreCells()) continue;
size_t i, j, k;
grid->ijkFromCellIndex(intersection.cellIndex, &i, &j, &k);
RigCompletionData completion(wellPath->completions()->wellNameForExport(), IJKCellIndex(i, j, k));
completion.addMetadata(location.fishbonesSubs->name(), QString("Sub: %1 Lateral: %2").arg(location.subIndex).arg(lateral.lateralIndex));
double diameter = location.fishbonesSubs->holeDiameter() / 1000;
if (settings.computeTransmissibility())
{
double transmissibility = RicWellPathExportCompletionDataFeature::calculateTransmissibility(settings.caseToApply,
wellPath,
intersection.lengthsInCell,
location.fishbonesSubs->skinFactor(),
diameter / 2,
intersection.cellIndex);
completion.setFromFishbone(transmissibility, location.fishbonesSubs->skinFactor());
}
else {
CellDirection direction = RicWellPathExportCompletionDataFeature::calculateDirectionInCell(settings.caseToApply, intersection.cellIndex, intersection.lengthsInCell);
completion.setFromFishbone(diameter, direction);
}
completionData.push_back(completion);
}
}
}
return completionData;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -95,6 +40,8 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneLateralsWell
const RigEclipseCaseData* caseData = settings.caseToApply()->eclipseCaseData();
std::vector<WellSegmentLocation> locations = RicWellPathExportCompletionDataFeature::findWellSegmentLocations(settings.caseToApply, wellPath);
RiaEclipseUnitTools::UnitSystem unitSystem = caseData->unitsType();
// Filter out cells where main bore is present
if (settings.removeLateralsInMainBoreCells())
{
@ -102,7 +49,7 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneLateralsWell
RicWellPathExportCompletionDataFeature::markWellPathCells(wellPathCells, &locations);
}
RigMainGrid* grid = settings.caseToApply->eclipseCaseData()->mainGrid();
bool isMainBore = false;
std::vector<RigCompletionData> completionData;
@ -114,11 +61,12 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneLateralsWell
{
if (intersection.mainBoreCell && settings.removeLateralsInMainBoreCells()) continue;
double diameter = location.fishbonesSubs->holeDiameter() / 1000;
QString completionMetaData = (location.fishbonesSubs->name(), QString("Sub: %1 Lateral: %2").arg(location.subIndex).arg(lateral.lateralIndex));
double diameter = location.fishbonesSubs->holeDiameter(unitSystem);
QString completionMetaData = (location.fishbonesSubs->name() + QString(" Sub: %1 Lateral: %2").arg(location.subIndex).arg(lateral.lateralIndex));
WellBorePartForTransCalc wellBorePart = WellBorePartForTransCalc(intersection.lengthsInCell,
diameter / 2,
location.fishbonesSubs->skinFactor(),
isMainBore,
completionMetaData);
wellBorePartsInCells[intersection.cellIndex].push_back(wellBorePart);
@ -154,32 +102,66 @@ std::vector<RigCompletionData> RicFishbonesTransmissibilityCalculationFeatureImp
bool cellIsActive = activeCellInfo->isActive(cellIndex);
if (!cellIsActive) continue;
//finding main bore and number of laterals
size_t numberOfLaterals = 0;
CellDirection mainBoreDirection = DIR_I;
for (auto wellBorePart : wellBoreParts)
{
if (!wellBorePart.isMainBore)
{
numberOfLaterals++;
}
else
{
mainBoreDirection = RicWellPathExportCompletionDataFeature::calculateDirectionInCell(settings.caseToApply,
cellIndex,
wellBorePart.lengthsInCell);
}
}
size_t NumberOfCellContributions = wellBoreParts.size();
//Simplest implementation possible, this can be improved later
//TODO: Find main bore direction and use this as direction in which to split cell
QString directionToSplitCellVolume = "DX";
for (WellBorePartForTransCalc wellBorePart : wellBoreParts)
{
RigCompletionData completion(wellPath->completions()->wellNameForExport(), IJKCellIndex(i, j, k));
completion.addMetadata(wellBorePart.metaData, "");
if (settings.computeTransmissibility())
double transmissibility = 0.0;
if (wellBorePart.isMainBore)
{
double transmissibility = RicWellPathExportCompletionDataFeature::calculateTransmissibility(settings.caseToApply,
//No change in transmissibility for main bore
transmissibility = RicWellPathExportCompletionDataFeature::calculateTransmissibility(settings.caseToApply,
wellPath,
wellBorePart.lengthsInCell,
wellBorePart.skinFactor,
wellBorePart.wellRadius,
cellIndex,
NumberOfCellContributions,
directionToSplitCellVolume);
completion.setFromFishbone(transmissibility, wellBorePart.skinFactor);
cellIndex);
}
else
else
{
CellDirection direction = RicWellPathExportCompletionDataFeature::calculateDirectionInCell(settings.caseToApply, cellIndex, wellBorePart.lengthsInCell);
completion.setFromFishbone(wellBorePart.wellRadius*2, direction);
//Adjust transmissibility for fishbone laterals
transmissibility = RicWellPathExportCompletionDataFeature::calculateTransmissibility(settings.caseToApply,
wellPath,
wellBorePart.lengthsInCell,
wellBorePart.skinFactor,
wellBorePart.wellRadius,
cellIndex,
numberOfLaterals,
mainBoreDirection);
}
CellDirection direction = RicWellPathExportCompletionDataFeature::calculateDirectionInCell(settings.caseToApply,
cellIndex,
wellBorePart.lengthsInCell);
completion.setTransAndWPImultBackgroundDataFromFishbone(transmissibility,
wellBorePart.skinFactor,
wellBorePart.wellRadius *2,
direction);
completionData.push_back(completion);
}
}
@ -189,52 +171,13 @@ std::vector<RigCompletionData> RicFishbonesTransmissibilityCalculationFeatureImp
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RigCompletionData> RicFishbonesTransmissibilityCalculationFeatureImp::generateFishbonesImportedLateralsCompdatValues(const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings)
{
std::vector<RigCompletionData> completionData;
std::vector<size_t> wellPathCells = RicWellPathExportCompletionDataFeature::findIntersectingCells(settings.caseToApply()->eclipseCaseData(), wellPath->wellPathGeometry()->m_wellPathPoints);
double diameter = wellPath->fishbonesCollection()->wellPathCollection()->holeDiameter() / 1000;
for (const RimFishboneWellPath* fishbonesPath : wellPath->fishbonesCollection()->wellPathCollection()->wellPaths())
{
std::vector<WellPathCellIntersectionInfo> intersectedCells = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(), fishbonesPath->coordinates());
for (auto& cell : intersectedCells)
{
if (settings.removeLateralsInMainBoreCells && std::find(wellPathCells.begin(), wellPathCells.end(), cell.cellIndex) != wellPathCells.end()) continue;
size_t i, j, k;
settings.caseToApply->eclipseCaseData()->mainGrid()->ijkFromCellIndex(cell.cellIndex, &i, &j, &k);
RigCompletionData completion(wellPath->completions()->wellNameForExport(), IJKCellIndex(i, j, k));
completion.addMetadata(fishbonesPath->name(), "");
if (settings.computeTransmissibility())
{
double skinFactor = wellPath->fishbonesCollection()->wellPathCollection()->skinFactor();
double transmissibility = RicWellPathExportCompletionDataFeature::calculateTransmissibility(settings.caseToApply(),
wellPath,
cell.internalCellLengths,
skinFactor,
diameter / 2,
cell.cellIndex);
completion.setFromFishbone(transmissibility, skinFactor);
}
else {
CellDirection direction = RicWellPathExportCompletionDataFeature::calculateDirectionInCell(settings.caseToApply, cell.cellIndex, cell.internalCellLengths);
completion.setFromFishbone(diameter, direction);
}
completionData.push_back(completion);
}
}
return completionData;
}
void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneImportedLateralsWellBoreParts(std::map<size_t, std::vector<WellBorePartForTransCalc> >& wellBorePartsInCells, const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings)
{
RiaEclipseUnitTools::UnitSystem unitSystem = settings.caseToApply->eclipseCaseData()->unitsType();
std::vector<size_t> wellPathCells = RicWellPathExportCompletionDataFeature::findIntersectingCells(settings.caseToApply()->eclipseCaseData(), wellPath->wellPathGeometry()->m_wellPathPoints);
bool isMainBore = false;
double diameter = wellPath->fishbonesCollection()->wellPathCollection()->holeDiameter() / 1000;
double diameter = wellPath->fishbonesCollection()->wellPathCollection()->holeDiameter(unitSystem);
for (const RimFishboneWellPath* fishbonesPath : wellPath->fishbonesCollection()->wellPathCollection()->wellPaths())
{
std::vector<WellPathCellIntersectionInfo> intersectedCells = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(), fishbonesPath->coordinates());
@ -247,6 +190,7 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneImportedLate
WellBorePartForTransCalc wellBorePart = WellBorePartForTransCalc(cell.internalCellLengths,
diameter / 2,
skinFactor,
isMainBore,
completionMetaData);
wellBorePartsInCells[cell.cellIndex].push_back(wellBorePart);
}
@ -256,9 +200,13 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneImportedLate
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicFishbonesTransmissibilityCalculationFeatureImp::findMainWellBoreParts(std::map<size_t, std::vector<WellBorePartForTransCalc>>& wellBorePartsInCells, const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings)
void RicFishbonesTransmissibilityCalculationFeatureImp::findMainWellBoreParts(std::map<size_t, std::vector<WellBorePartForTransCalc>>& wellBorePartsInCells,
const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings)
{
double holeDiameter = wellPath->fishbonesCollection()->wellPathCollection()->holeDiameter();
RiaEclipseUnitTools::UnitSystem unitSystem = settings.caseToApply->eclipseCaseData()->unitsType();
bool isMainBore = true;
double holeDiameter = wellPath->fishbonesCollection()->mainBoreDiameter(unitSystem);
double FishboneStartMD = wellPath->fishbonesCollection()->startMD();
std::vector<double> wellPathMD = wellPath->wellPathGeometry()->m_measuredDepths;
@ -278,6 +226,7 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findMainWellBoreParts(st
WellBorePartForTransCalc wellBorePart = WellBorePartForTransCalc(cell.internalCellLengths,
holeDiameter / 2,
skinFactor,
isMainBore,
completionMetaData);
wellBorePartsInCells[cell.cellIndex].push_back(wellBorePart);

View File

@ -37,10 +37,12 @@ struct WellBorePartForTransCalc {
WellBorePartForTransCalc(cvf::Vec3d lengthsInCell,
double wellRadius,
double skinFactor,
bool isMainBore,
QString metaData)
: lengthsInCell(lengthsInCell),
wellRadius(wellRadius),
skinFactor(skinFactor),
isMainBore(isMainBore),
metaData(metaData)
{}
@ -48,6 +50,7 @@ struct WellBorePartForTransCalc {
double wellRadius;
double skinFactor;
QString metaData;
bool isMainBore;
};
//==================================================================================================
@ -56,13 +59,8 @@ struct WellBorePartForTransCalc {
class RicFishbonesTransmissibilityCalculationFeatureImp
{
public:
static std::vector<RigCompletionData> generateFishboneLateralsCompdatValues(const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings);
static std::vector<RigCompletionData> generateFishbonesImportedLateralsCompdatValues(const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings);
static std::vector<RigCompletionData> generateFishboneCompdatValuesUsingAdjustedCellVolume(const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings);
const RicExportCompletionDataSettingsUi& settings);

View File

@ -57,7 +57,14 @@ void RicNewFishbonesSubsFeature::onActionTriggered(bool isChecked)
RicNewFishbonesSubsFeature::askUserToSetUsefulScaling(fishbonesCollection);
fishbonesCollection->updateConnectedEditors();
RimWellPathCollection* wellPathCollection = nullptr;
fishbonesCollection->firstAncestorOrThisOfType(wellPathCollection);
if (wellPathCollection)
{
wellPathCollection->uiCapability()->updateConnectedEditors();
}
RiuMainWindow::instance()->selectAsCurrentItem(obj);
RimProject* proj;
@ -80,6 +87,16 @@ RimFishbonesCollection* RicNewFishbonesSubsFeature::selectedFishbonesCollection(
objHandle->firstAncestorOrThisOfType(objToFind);
}
if (objToFind == nullptr)
{
std::vector<RimWellPath*> wellPaths;
caf::SelectionManager::instance()->objectsByType(&wellPaths);
if (!wellPaths.empty())
{
return wellPaths[0]->fishbonesCollection();
}
}
return objToFind;
}

View File

@ -74,6 +74,7 @@ void RicNewPerforationIntervalFeature::onActionTriggered(bool isChecked)
//--------------------------------------------------------------------------------------------------
void RicNewPerforationIntervalFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/PerforationInterval16x16.png"));
actionToSetup->setText("New Perforation Interval");
}
@ -92,5 +93,15 @@ RimPerforationCollection* RicNewPerforationIntervalFeature::selectedPerforationC
objHandle->firstAncestorOrThisOfType(objToFind);
}
if (objToFind == nullptr)
{
std::vector<RimWellPath*> wellPaths;
caf::SelectionManager::instance()->objectsByType(&wellPaths);
if (!wellPaths.empty())
{
return wellPaths[0]->perforationIntervalCollection();
}
}
return objToFind;
}

View File

@ -57,6 +57,7 @@
#include <QMessageBox>
#include "RicFishbonesTransmissibilityCalculationFeatureImp.h"
#include "RicExportFractureCompletionsImpl.h"
#include "RigActiveCellInfo.h"
CAF_CMD_SOURCE_INIT(RicWellPathExportCompletionDataFeature, "RicWellPathExportCompletionDataFeature");
@ -131,12 +132,12 @@ void RicWellPathExportCompletionDataFeature::onActionTriggered(bool isChecked)
}
}
exportSettings.fileName = QDir(defaultDir).filePath("Completions");
exportSettings.folder = defaultDir;
caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export Completion Data", "");
if (propertyDialog.exec() == QDialog::Accepted)
{
RiaApplication::instance()->setLastUsedDialogDirectory("COMPLETIONS", QFileInfo(exportSettings.fileName).absolutePath());
RiaApplication::instance()->setLastUsedDialogDirectory("COMPLETIONS", QFileInfo(exportSettings.folder).absolutePath());
exportCompletions(wellPaths, simWells, exportSettings);
}
@ -202,9 +203,10 @@ std::vector<RimEclipseWell*> RicWellPathExportCompletionDataFeature::selectedSim
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellPathExportCompletionDataFeature::exportCompletions(const std::vector<RimWellPath*>& wellPaths, const std::vector<RimEclipseWell*>& simWells, const RicExportCompletionDataSettingsUi& exportSettings)
void RicWellPathExportCompletionDataFeature::exportCompletions(const std::vector<RimWellPath*>& wellPaths,
const std::vector<RimEclipseWell*>& simWells,
const RicExportCompletionDataSettingsUi& exportSettings)
{
QFile exportFile(exportSettings.fileName());
if (exportSettings.caseToApply() == nullptr)
{
@ -212,22 +214,27 @@ void RicWellPathExportCompletionDataFeature::exportCompletions(const std::vector
return;
}
if (!exportFile.open(QIODevice::WriteOnly))
std::vector<RimWellPath*> usedWellPaths;
if (exportSettings.wellSelection == RicExportCompletionDataSettingsUi::ALL_WELLS)
{
RiaLogging::error(QString("Export Completions Data: Could not open the file: %1").arg(exportSettings.fileName()));
return;
usedWellPaths = wellPaths;
}
else if (exportSettings.wellSelection == RicExportCompletionDataSettingsUi::CHECKED_WELLS)
{
for (auto wellPath : wellPaths)
{
if (wellPath->showWellPath)
{
usedWellPaths.push_back(wellPath);
}
}
}
{
bool unitSystemMismatch = false;
for (const RimWellPath* wellPath : wellPaths)
for (const RimWellPath* wellPath : usedWellPaths)
{
if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_FIELD && exportSettings.caseToApply->eclipseCaseData()->unitsType() != RigEclipseCaseData::UNITS_FIELD)
{
unitSystemMismatch = true;
break;
}
else if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_METRIC && exportSettings.caseToApply->eclipseCaseData()->unitsType() != RigEclipseCaseData::UNITS_METRIC)
if (wellPath->unitSystem() != exportSettings.caseToApply->eclipseCaseData()->unitsType())
{
unitSystemMismatch = true;
break;
@ -249,63 +256,234 @@ void RicWellPathExportCompletionDataFeature::exportCompletions(const std::vector
return;
}
}
std::map<IJKCellIndex, std::vector<RigCompletionData> > completionsPerEclipseCell;
// FractureTransmissibilityExportInformation
QTextStream stream(&exportFile);
RifEclipseDataTableFormatter formatter(stream);
QString fractureTransmisibillityExportInformationPath = QDir(exportSettings.folder).filePath("FractureTransmissibilityExportInformation");
QFile fractureTransmissibilityExportInformationFile(fractureTransmisibillityExportInformationPath);
if (!fractureTransmissibilityExportInformationFile.open(QIODevice::WriteOnly))
{
RiaLogging::error(QString("Export Completions Data: Could not open the file: %1").arg(fractureTransmisibillityExportInformationPath));
return;
}
QTextStream fractureTransmissibilityExportInformationStream(&fractureTransmissibilityExportInformationFile);
std::map<IJKCellIndex, RigCompletionData> completionData;
for (auto wellPath : wellPaths)
for (auto wellPath : usedWellPaths)
{
// Generate completion data
if (exportSettings.includePerforations)
{
std::vector<RigCompletionData> perforationCompletionData = generatePerforationsCompdatValues(wellPath, exportSettings);
appendCompletionData(&completionData, perforationCompletionData);
appendCompletionData(&completionsPerEclipseCell, perforationCompletionData);
}
if (exportSettings.includeFishbones)
{
// std::vector<RigCompletionData> fishbonesCompletionData = RicFishbonesTransmissibilityCalculationFeatureImp::generateFishboneLateralsCompdatValues(wellPath, exportSettings);
// appendCompletionData(&completionData, fishbonesCompletionData);
// std::vector<RigCompletionData> fishbonesWellPathCompletionData = RicFishbonesTransmissibilityCalculationFeatureImp::generateFishbonesImportedLateralsCompdatValues(wellPath, exportSettings);
// appendCompletionData(&completionData, fishbonesWellPathCompletionData);
std::vector<RigCompletionData> fishbonesCompletionData = RicFishbonesTransmissibilityCalculationFeatureImp::generateFishboneCompdatValuesUsingAdjustedCellVolume(wellPath, exportSettings);
appendCompletionData(&completionData, fishbonesCompletionData);
appendCompletionData(&completionsPerEclipseCell, fishbonesCompletionData);
}
if (exportSettings.includeFractures())
{
std::vector<RigCompletionData> fractureCompletionData = RicExportFractureCompletionsImpl::generateCompdatValuesForWellPath(wellPath, exportSettings, &stream);
appendCompletionData(&completionData, fractureCompletionData);
std::vector<RigCompletionData> fractureCompletionData = RicExportFractureCompletionsImpl::generateCompdatValuesForWellPath(wellPath, exportSettings, &fractureTransmissibilityExportInformationStream);
appendCompletionData(&completionsPerEclipseCell, fractureCompletionData);
}
}
for (auto simWell : simWells)
{
std::vector<RigCompletionData> fractureCompletionData = RicExportFractureCompletionsImpl::generateCompdatValuesForSimWell(exportSettings.caseToApply(), simWell, exportSettings.timeStep(), &stream);
appendCompletionData(&completionData, fractureCompletionData);
std::vector<RigCompletionData> fractureCompletionData = RicExportFractureCompletionsImpl::generateCompdatValuesForSimWell(exportSettings.caseToApply(), simWell, exportSettings.timeStep(), &fractureTransmissibilityExportInformationStream);
appendCompletionData(&completionsPerEclipseCell, fractureCompletionData);
}
// Merge map into a vector of values
std::vector<RigCompletionData> completions;
for (auto& data : completionData)
//std::map < IJKCellIndex, std::map<QString, RigCompletionData >> combinedCompletionDataPerEclipseCell;
//Should be moved to map instead of vector
for (auto& data : completionsPerEclipseCell)
{
completions.push_back(data.second);
//completions.push_back(RigCompletionData::combine(data.second));
completions.push_back(combineEclipseCellCompletions(data.second, exportSettings));
}
const QString eclipseCaseName = exportSettings.caseToApply->caseUserDescription();
if (exportSettings.fileSplit == RicExportCompletionDataSettingsUi::UNIFIED_FILE)
{
const QString fileName = QString("UnifiedCompletions_%1").arg(eclipseCaseName);
printCompletionsToFile(exportSettings.folder, fileName, completions, exportSettings.includeWpimult);
}
else if (exportSettings.fileSplit == RicExportCompletionDataSettingsUi::SPLIT_ON_WELL)
{
for (auto wellPath : usedWellPaths)
{
std::vector<RigCompletionData> wellCompletions;
for (auto completion : completions)
{
if (completion.wellName() == wellPath->completions()->wellNameForExport())
{
wellCompletions.push_back(completion);
}
}
QString fileName = QString("%1_unifiedCompletions_%2").arg(wellPath->name()).arg(eclipseCaseName);
printCompletionsToFile(exportSettings.folder, fileName, wellCompletions, exportSettings.includeWpimult);
}
}
else if (exportSettings.fileSplit == RicExportCompletionDataSettingsUi::SPLIT_ON_WELL_AND_COMPLETION_TYPE)
{
for (auto wellPath : usedWellPaths)
{
{
std::vector<RigCompletionData> fishbonesCompletions = getCompletionsForWellAndCompletionType(completions, wellPath->completions()->wellNameForExport(), RigCompletionData::FISHBONES);
QString fileName = QString("%1_Fishbones_%2").arg(wellPath->name()).arg(eclipseCaseName);
printCompletionsToFile(exportSettings.folder, fileName, fishbonesCompletions, exportSettings.includeWpimult);
}
{
std::vector<RigCompletionData> perforationCompletions = getCompletionsForWellAndCompletionType(completions, wellPath->completions()->wellNameForExport(), RigCompletionData::PERFORATION);
QString fileName = QString("%1_Perforations_%2").arg(wellPath->name()).arg(eclipseCaseName);
printCompletionsToFile(exportSettings.folder, fileName, perforationCompletions, exportSettings.includeWpimult);
}
}
}
}
//==================================================================================================
///
//==================================================================================================
RigCompletionData RicWellPathExportCompletionDataFeature::combineEclipseCellCompletions(const std::vector<RigCompletionData>& completions,
const RicExportCompletionDataSettingsUi& settings)
{
CVF_ASSERT(!completions.empty());
QString wellName = completions[0].wellName();
IJKCellIndex cellIndexIJK = completions[0].cellIndex();
RigMainGrid* grid = settings.caseToApply->eclipseCaseData()->mainGrid();
size_t cellIndex = grid->cellIndexFromIJK(cellIndexIJK.i, cellIndexIJK.j, cellIndexIJK.k);
RigCompletionData::CompletionType completionType = completions[0].completionType();
//completion type, skin factor, well bore diameter and cell direction are taken from (first) main bore,
//if no main bore they are taken from first completion
double skinfactor = completions[0].skinFactor();
double wellBoreDiameter = completions[0].diameter();
CellDirection cellDirection = completions[0].direction();
for (const RigCompletionData& completion : completions)
{
if (completion.isMainBore())
{
skinfactor = completion.skinFactor();
wellBoreDiameter = completion.diameter();
cellDirection = completion.direction();
break;
}
}
RigCompletionData resultCompletion(wellName, cellIndexIJK);
double totalTrans = 0.0;
for (const RigCompletionData& completion : completions)
{
if (completion.completionType() != completions[0].completionType())
{
RiaLogging::error(QString("Cannot combine completions of different types in same cell [%1, %2, %3]").arg(cellIndexIJK.i).arg(cellIndexIJK.j).arg(cellIndexIJK.k));
return resultCompletion; //Returning empty completion, should not be exported
}
if (completion.wellName() != completions[0].wellName())
{
RiaLogging::error(QString("Cannot combine completions from different wells in same cell [%1, %2, %3]").arg(cellIndexIJK.i).arg(cellIndexIJK.j).arg(cellIndexIJK.k));
return resultCompletion; //Returning empty completion, should not be exported
}
if (completion.transmissibility() == HUGE_VAL)
{
RiaLogging::error(QString("Transmissibility calculation has failed for cell [%1, %2, %3]").arg(cellIndexIJK.i).arg(cellIndexIJK.j).arg(cellIndexIJK.k));
return resultCompletion; //Returning empty completion, should not be exported
}
totalTrans = totalTrans + completion.transmissibility();
}
if (settings.computeTransmissibility() && !settings.includeWpimult) //TODO: replace with explicitTransmissibilityExport setting
{
resultCompletion.setCombinedValuesExplicitTrans(totalTrans, completionType);
}
if (settings.includeWpimult) //TODO: replace with implicitTransmissibilityExportByWPImult
{
//calculate trans for main bore - but as Eclipse will do it!
double transmissibilityEclipseCalculation = RicWellPathExportCompletionDataFeature::calculateTransmissibilityAsEclipseDoes(settings.caseToApply(),
skinfactor,
wellBoreDiameter / 2,
cellIndex,
cellDirection);
double wpimult = totalTrans / transmissibilityEclipseCalculation;
resultCompletion.setCombinedValuesImplicitTransWPImult(wpimult, cellDirection, skinfactor, wellBoreDiameter, completionType);
}
return resultCompletion;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellPathExportCompletionDataFeature::printCompletionsToFile(const QString& exportFolder, const QString& fileName, std::vector<RigCompletionData>& completions, bool includeWpimult)
{
//TODO: Check that completion is ready for export
//TODO: Use wpimult instead of count for export!
QString filePath = QDir(exportFolder).filePath(fileName);
QFile exportFile(filePath);
if (!exportFile.open(QIODevice::WriteOnly))
{
RiaLogging::error(QString("Export Completions Data: Could not open the file: %1").arg(filePath));
return;
}
QTextStream stream(&exportFile);
RifEclipseDataTableFormatter formatter(stream);
// Sort by well name / cell index
std::sort(completions.begin(), completions.end());
// Print completion data
generateCompdatTable(formatter, completions);
if (exportSettings.includeWpimult)
if (includeWpimult)
{
generateWpimultTable(formatter, completions);
}
RiaLogging::info(QString("Successfully exported completion data to %1").arg(exportSettings.fileName()));
RiaLogging::info(QString("Successfully exported completion data to %1").arg(filePath));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RigCompletionData> RicWellPathExportCompletionDataFeature::getCompletionsForWellAndCompletionType(const std::vector<RigCompletionData>& completions,
const QString& wellName,
RigCompletionData::CompletionType completionType)
{
std::vector<RigCompletionData> filteredCompletions;
for (auto completion : completions)
{
if (completion.wellName() == wellName && completion.completionType() == completionType)
{
filteredCompletions.push_back(completion);
}
}
return filteredCompletions;
}
//--------------------------------------------------------------------------------------------------
@ -420,7 +598,11 @@ void RicWellPathExportCompletionDataFeature::generateWpimultTable(RifEclipseData
//--------------------------------------------------------------------------------------------------
std::vector<RigCompletionData> RicWellPathExportCompletionDataFeature::generatePerforationsCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings)
{
RiaEclipseUnitTools::UnitSystem unitSystem = settings.caseToApply->eclipseCaseData()->unitsType();
std::vector<RigCompletionData> completionData;
const RigActiveCellInfo* activeCellInfo = settings.caseToApply->eclipseCaseData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS);
for (const RimPerforationInterval* interval : wellPath->perforationIntervalCollection()->perforations())
{
@ -430,13 +612,28 @@ std::vector<RigCompletionData> RicWellPathExportCompletionDataFeature::generateP
std::vector<WellPathCellIntersectionInfo> intersectedCells = RigWellPathIntersectionTools::findCellsIntersectedByPath(settings.caseToApply->eclipseCaseData(), perforationPoints);
for (auto& cell : intersectedCells)
{
bool cellIsActive = activeCellInfo->isActive(cell.cellIndex);
if (!cellIsActive) continue;
size_t i, j, k;
settings.caseToApply->eclipseCaseData()->mainGrid()->ijkFromCellIndex(cell.cellIndex, &i, &j, &k);
RigCompletionData completion(wellPath->completions()->wellNameForExport(), IJKCellIndex(i, j, k));
completion.addMetadata("Perforation", QString("StartMD: %1 - EndMD: %2").arg(interval->startMD()).arg(interval->endMD()));
double diameter = interval->diameter();
CellDirection direction = calculateDirectionInCell(settings.caseToApply, cell.cellIndex, cell.internalCellLengths);
completion.setFromPerforation(diameter, direction);
double transmissibility = RicWellPathExportCompletionDataFeature::calculateTransmissibility(settings.caseToApply,
wellPath,
cell.internalCellLengths,
interval->skinFactor(),
interval->diameter(unitSystem) / 2,
cell.cellIndex);
completion.setTransAndWPImultBackgroundDataFromPerforation(transmissibility,
interval->skinFactor(),
interval->diameter(unitSystem),
direction);
completionData.push_back(completion);
}
}
@ -612,18 +809,18 @@ void RicWellPathExportCompletionDataFeature::assignBranchAndSegmentNumbers(const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellPathExportCompletionDataFeature::appendCompletionData(std::map<IJKCellIndex, RigCompletionData>* completionData, const std::vector<RigCompletionData>& data)
void RicWellPathExportCompletionDataFeature::appendCompletionData(std::map<IJKCellIndex, std::vector<RigCompletionData> >* completionData, const std::vector<RigCompletionData>& data)
{
for (auto& completion : data)
{
auto it = completionData->find(completion.cellIndex());
if (it != completionData->end())
{
it->second = RigCompletionData::combine(it->second, completion);
it->second.push_back(completion);
}
else
{
completionData->insert(std::pair<IJKCellIndex, RigCompletionData>(completion.cellIndex(), completion));
completionData->insert(std::pair<IJKCellIndex, std::vector<RigCompletionData> >(completion.cellIndex(), std::vector<RigCompletionData> {completion}));
}
}
}
@ -670,7 +867,7 @@ double RicWellPathExportCompletionDataFeature::calculateTransmissibility(RimEcli
double wellRadius,
size_t cellIndex,
size_t volumeScaleConstant,
QString directionForVolumeScaling)
CellDirection directionForVolumeScaling)
{
RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData();
@ -699,9 +896,9 @@ double RicWellPathExportCompletionDataFeature::calculateTransmissibility(RimEcli
if (volumeScaleConstant != 1)
{
if (directionForVolumeScaling == "DX") dx = dx / volumeScaleConstant;
if (directionForVolumeScaling == "DY") dy = dy / volumeScaleConstant;
if (directionForVolumeScaling == "DZ") dz = dz / volumeScaleConstant;
if (directionForVolumeScaling == CellDirection::DIR_I) dx = dx / volumeScaleConstant;
if (directionForVolumeScaling == CellDirection::DIR_J) dy = dy / volumeScaleConstant;
if (directionForVolumeScaling == CellDirection::DIR_K) dz = dz / volumeScaleConstant;
}
double transx = RigTransmissibilityEquations::wellBoreTransmissibilityComponent(internalCellLengths.x(), permy, permz, dy, dz, wellRadius, skinFactor, darcy);
@ -710,3 +907,56 @@ double RicWellPathExportCompletionDataFeature::calculateTransmissibility(RimEcli
return RigTransmissibilityEquations::totalConnectionFactor(transx, transy, transz);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicWellPathExportCompletionDataFeature::calculateTransmissibilityAsEclipseDoes(RimEclipseCase* eclipseCase,
double skinFactor,
double wellRadius,
size_t cellIndex,
CellDirection direction)
{
RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData();
eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "DX");
cvf::ref<RigResultAccessor> dxAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "DX");
eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "DY");
cvf::ref<RigResultAccessor> dyAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "DY");
eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "DZ");
cvf::ref<RigResultAccessor> dzAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "DZ");
eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PERMX");
cvf::ref<RigResultAccessor> permxAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "PERMX");
eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PERMY");
cvf::ref<RigResultAccessor> permyAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "PERMY");
eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PERMZ");
cvf::ref<RigResultAccessor> permzAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "PERMZ");
double dx = dxAccessObject->cellScalarGlobIdx(cellIndex);
double dy = dyAccessObject->cellScalarGlobIdx(cellIndex);
double dz = dzAccessObject->cellScalarGlobIdx(cellIndex);
double permx = permxAccessObject->cellScalarGlobIdx(cellIndex);
double permy = permxAccessObject->cellScalarGlobIdx(cellIndex);
double permz = permxAccessObject->cellScalarGlobIdx(cellIndex);
RiaEclipseUnitTools::UnitSystem units = eclipseCaseData->unitsType();
double darcy = RiaEclipseUnitTools::darcysConstant(units);
double trans = cvf::UNDEFINED_DOUBLE;
if (direction == CellDirection::DIR_I)
{
trans = RigTransmissibilityEquations::wellBoreTransmissibilityComponent(dx, permy, permz, dy, dz, wellRadius, skinFactor, darcy);
}
else if (direction == CellDirection::DIR_J)
{
trans = RigTransmissibilityEquations::wellBoreTransmissibilityComponent(dy, permx, permz, dx, dz, wellRadius, skinFactor, darcy);
}
else if (direction == CellDirection::DIR_K)
{
trans = RigTransmissibilityEquations::wellBoreTransmissibilityComponent(dz, permy, permx, dy, dx, wellRadius, skinFactor, darcy);
}
return trans;
}

View File

@ -138,9 +138,26 @@ public:
static void markWellPathCells(const std::vector<size_t>& wellPathCells, std::vector<WellSegmentLocation>* locations);
static CellDirection calculateDirectionInCell(RimEclipseCase* eclipseCase, size_t cellIndex, const cvf::Vec3d& lengthsInCell);
static double calculateTransmissibility(RimEclipseCase* eclipseCase, const RimWellPath* wellPath, const cvf::Vec3d& internalCellLengths, double skinFactor, double wellRadius, size_t cellIndex, size_t volumeScaleConstant = 1, QString directionForVolumeScaling = "DX");
static double calculateTransmissibility(RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
const cvf::Vec3d& internalCellLengths,
double skinFactor,
double wellRadius,
size_t cellIndex,
size_t volumeScaleConstant = 1,
CellDirection directionForVolumeScaling = CellDirection::DIR_I);
static double calculateTransmissibilityAsEclipseDoes(RimEclipseCase* eclipseCase,
double skinFactor,
double wellRadius,
size_t cellIndex,
CellDirection direction);
private:
static RigCompletionData combineEclipseCellCompletions(const std::vector<RigCompletionData>& completions,
const RicExportCompletionDataSettingsUi& settings);
static void exportCompletions(const std::vector<RimWellPath*>& wellPaths, const std::vector<RimEclipseWell*>& simWells, const RicExportCompletionDataSettingsUi& exportSettings);
static void printCompletionsToFile(const QString& exportFolder, const QString& fileName, std::vector<RigCompletionData>& completions, bool includeWpimult);
static std::vector<RigCompletionData> getCompletionsForWellAndCompletionType(const std::vector<RigCompletionData>& completions, const QString& wellName, RigCompletionData::CompletionType completionType);
static void generateCompdatTable(RifEclipseDataTableFormatter& formatter, const std::vector<RigCompletionData>& completionData);
static void generateWpimultTable(RifEclipseDataTableFormatter& formatter, const std::vector<RigCompletionData>& completionData);
@ -152,7 +169,7 @@ private:
static void calculateLateralIntersections(const RimEclipseCase* caseToApply, WellSegmentLocation* location, int* branchNum, int* segmentNum);
static void assignBranchAndSegmentNumbers(const RimEclipseCase* caseToApply, std::vector<WellSegmentLocation>* locations);
static void appendCompletionData(std::map<IJKCellIndex, RigCompletionData>* completionData, const std::vector<RigCompletionData>& data);
static void appendCompletionData(std::map<IJKCellIndex, std::vector<RigCompletionData> >* completionData, const std::vector<RigCompletionData>& data);
};

View File

@ -25,6 +25,7 @@
#include "RimProject.h"
#include "RimWellPath.h"
#include "RimWellPathCompletions.h"
#include "RimWellPathCollection.h"
#include "RiuMainWindow.h"
@ -53,8 +54,8 @@ bool RicWellPathImportCompletionsFileFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicWellPathImportCompletionsFileFeature::onActionTriggered(bool isChecked)
{
RimFishboneWellPathCollection* wellPathCollection = RicWellPathImportCompletionsFileFeature::selectedWellPathCollection();
CVF_ASSERT(wellPathCollection);
RimFishboneWellPathCollection* fishbonesWellPathCollection = RicWellPathImportCompletionsFileFeature::selectedWellPathCollection();
CVF_ASSERT(fishbonesWellPathCollection);
// Open dialog box to select well path files
RiaApplication* app = RiaApplication::instance();
@ -66,7 +67,14 @@ void RicWellPathImportCompletionsFileFeature::onActionTriggered(bool isChecked)
// Remember the path to next time
app->setLastUsedDialogDirectory("WELLPATH_DIR", QFileInfo(wellPathFilePaths.last()).absolutePath());
wellPathCollection->importCompletionsFromFile(wellPathFilePaths);
fishbonesWellPathCollection->importCompletionsFromFile(wellPathFilePaths);
RimWellPathCollection* wellPathCollection;
fishbonesWellPathCollection->firstAncestorOrThisOfType(wellPathCollection);
if (wellPathCollection)
{
wellPathCollection->updateConnectedEditors();
}
if (app->project())
{
@ -88,15 +96,26 @@ void RicWellPathImportCompletionsFileFeature::setupActionLook(QAction* actionToS
//--------------------------------------------------------------------------------------------------
RimFishboneWellPathCollection* RicWellPathImportCompletionsFileFeature::selectedWellPathCollection()
{
std::vector<caf::PdmObject*> objects;
caf::SelectionManager::instance()->objectsByType(&objects);
if (objects.size() > 0)
RimFishbonesCollection* objToFind = nullptr;
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(pdmUiItem);
if (objHandle)
{
RimFishboneWellPathCollection* fbWellColl = nullptr;
objects[0]->firstAncestorOrThisOfType(fbWellColl);
objHandle->firstAncestorOrThisOfType(objToFind);
}
return fbWellColl;
if (objToFind == nullptr)
{
std::vector<RimWellPath*> wellPaths;
caf::SelectionManager::instance()->objectsByType(&wellPaths);
if (!wellPaths.empty())
{
return wellPaths[0]->fishbonesCollection()->wellPathCollection();
}
}
else
{
return objToFind->wellPathCollection();
}
return nullptr;

View File

@ -85,9 +85,7 @@ void RicNewSimWellFractureAtPosFeature::onActionTriggered(bool isChecked)
RimEclipseResultCase* eclipseCase = nullptr;
simWell->firstAncestorOrThisOfType(eclipseCase);
RigEclipseCaseData::UnitsType caseUnit = eclipseCase->eclipseCaseData()->unitsType();
if (caseUnit == RigEclipseCaseData::UNITS_METRIC) fracture->fractureUnit = RiaEclipseUnitTools::UNITS_METRIC;
else if (caseUnit == RigEclipseCaseData::UNITS_FIELD) fracture->fractureUnit = RiaEclipseUnitTools::UNITS_FIELD;
fracture->fractureUnit = eclipseCase->eclipseCaseData()->unitsType();
if (oilfield->fractureDefinitionCollection->fractureDefinitions.size() > 0)
{

View File

@ -71,9 +71,7 @@ void RicNewSimWellFractureFeature::onActionTriggered(bool isChecked)
RimEclipseResultCase* eclipseCase = nullptr;
objHandle->firstAncestorOrThisOfType(eclipseCase);
RigEclipseCaseData::UnitsType caseUnit = eclipseCase->eclipseCaseData()->unitsType();
if (caseUnit == RigEclipseCaseData::UNITS_METRIC) fracture->fractureUnit = RiaEclipseUnitTools::UNITS_METRIC;
else if (caseUnit == RigEclipseCaseData::UNITS_FIELD) fracture->fractureUnit = RiaEclipseUnitTools::UNITS_FIELD;
fracture->fractureUnit = eclipseCase->eclipseCaseData()->unitsType();
if (oilfield->fractureDefinitionCollection->fractureDefinitions.size() > 0)
{

View File

@ -691,16 +691,16 @@ void RifReaderEclipseOutput::buildMetaData()
}
// Default units type is METRIC
RigEclipseCaseData::UnitsType unitsType = RigEclipseCaseData::UNITS_METRIC;
RiaEclipseUnitTools::UnitSystem unitsType = RiaEclipseUnitTools::UNITS_METRIC;
{
int unitsTypeValue = m_dynamicResultsAccess->readUnitsType();
if (unitsTypeValue == 2)
{
unitsType = RigEclipseCaseData::UNITS_FIELD;
unitsType = RiaEclipseUnitTools::UNITS_FIELD;
}
else if (unitsTypeValue == 3)
{
unitsType = RigEclipseCaseData::UNITS_LAB;
unitsType = RiaEclipseUnitTools::UNITS_LAB;
}
}
@ -985,8 +985,8 @@ RigWellResultPoint RifReaderEclipseOutput::createWellResultPoint(const RigGridBa
double fieldGasToOilEquivalent = 1.0e6/5800; // Mega ft^3 to BOE
double metricGasToOilEquivalent = 1.0/1.0e3; // Sm^3 Gas to Sm^3 oe
if (m_eclipseCase->unitsType() == RigEclipseCaseData::UNITS_FIELD) gasRate = fieldGasToOilEquivalent * gasRate;
if (m_eclipseCase->unitsType() == RigEclipseCaseData::UNITS_METRIC) gasRate = metricGasToOilEquivalent * gasRate;
if (m_eclipseCase->unitsType() == RiaEclipseUnitTools::UNITS_FIELD) gasRate = fieldGasToOilEquivalent * gasRate;
if (m_eclipseCase->unitsType() == RiaEclipseUnitTools::UNITS_METRIC) gasRate = metricGasToOilEquivalent * gasRate;
resultPoint.m_gasRate = gasRate;
}

View File

@ -62,5 +62,5 @@ private:
caf::PdmField< std::vector< cvf::Vec3d> > m_coordinates;
caf::PdmField< std::vector< double > > m_measuredDepths;
caf::PdmProxyValueField< QString > m_displayCoordinates;
caf::PdmProxyValueField< QString > m_displayCoordinates;
};

View File

@ -23,6 +23,7 @@
#include "RimFishboneWellPath.h"
#include "RimView.h"
#include "RimProject.h"
#include "RimFishbonesCollection.h"
#include "RigWellPath.h"
@ -53,6 +54,36 @@ RimFishboneWellPathCollection::RimFishboneWellPathCollection()
m_pipeProperties = new RimFishbonesPipeProperties;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishboneWellPathCollection::importCompletionsFromFile(const QStringList& filePaths)
{
RifWellPathImporter wellPathImporter;
for (const QString& filePath : filePaths)
{
size_t wellDataCount = wellPathImporter.wellDataCount(filePath);
for (size_t i = 0; i < wellDataCount; ++i)
{
RifWellPathImporter::WellData wellData = wellPathImporter.readWellData(filePath, i);
RimFishboneWellPath* wellCompletion = new RimFishboneWellPath();
wellCompletion->setName(wellData.m_name);
wellCompletion->setCoordinates(wellData.m_wellPathGeometry->m_wellPathPoints);
wellCompletion->setMeasuredDepths(wellData.m_wellPathGeometry->m_measuredDepths);
appendCompletion(wellCompletion);
}
}
RimFishbonesCollection* fishbonesCollection;
firstAncestorOrThisOfType(fishbonesCollection);
if (fishbonesCollection != nullptr)
{
fishbonesCollection->recalculateStartMD();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -78,6 +109,14 @@ std::vector<const RimFishboneWellPath*> RimFishboneWellPathCollection::wellPaths
return paths;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishboneWellPathCollection::setUnitSystemSpecificDefaults()
{
m_pipeProperties->setUnitSystemSpecificDefaults();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -106,25 +145,3 @@ void RimFishboneWellPathCollection::appendCompletion(RimFishboneWellPath* comple
project->reloadCompletionTypeResultsInAllViews();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishboneWellPathCollection::importCompletionsFromFile(const QStringList& filePaths)
{
RifWellPathImporter wellPathImporter;
foreach(const QString& filePath, filePaths) {
size_t wellDataCount = wellPathImporter.wellDataCount(filePath);
for (size_t i = 0; i < wellDataCount; ++i)
{
RifWellPathImporter::WellData wellData = wellPathImporter.readWellData(filePath, i);
RimFishboneWellPath* wellCompletion = new RimFishboneWellPath();
wellCompletion->setName(wellData.m_name);
wellCompletion->setCoordinates(wellData.m_wellPathGeometry->m_wellPathPoints);
wellCompletion->setMeasuredDepths(wellData.m_wellPathGeometry->m_measuredDepths);
appendCompletion(wellCompletion);
}
}
}

View File

@ -23,6 +23,8 @@
#include "RimFishboneWellPath.h"
#include "RimFishbonesPipeProperties.h"
#include "RiaEclipseUnitTools.h"
#include "cafPdmObject.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmChildField.h"
@ -40,19 +42,21 @@ class RimFishboneWellPathCollection : public RimCheckableNamedObject
public:
RimFishboneWellPathCollection();
void importCompletionsFromFile(const QStringList& filePaths);
void importCompletionsFromFile(const QStringList& filePaths);
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
std::vector<const RimFishboneWellPath*> wellPaths() const;
double holeDiameter() const { return m_pipeProperties->holeDiameter(); }
double holeDiameter(RiaEclipseUnitTools::UnitSystem unitSystem) const { return m_pipeProperties->holeDiameter(unitSystem); }
double skinFactor() const { return m_pipeProperties->skinFactor(); }
void setUnitSystemSpecificDefaults();
protected:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
private:
void appendCompletion(RimFishboneWellPath* completion);
void appendCompletion(RimFishboneWellPath* completion);
private:
caf::PdmChildArrayField<RimFishboneWellPath*> m_wellPaths;

View File

@ -55,6 +55,8 @@ RimFishbonesCollection::RimFishbonesCollection()
CAF_PDM_InitField(&m_mainBoreDiameter, "MainBoreDiameter", 0.216, "Main Bore Diameter", "", "", "");
CAF_PDM_InitField(&m_linerDiameter, "LinerDiameter", 0.152, "Liner Inner Diameter", "", "", "");
CAF_PDM_InitField(&m_roughnessFactor, "RoughnessFactor", 1e-05, "Roughness Factor", "", "", "");
manuallyModifiedStartMD = false;
}
//--------------------------------------------------------------------------------------------------
@ -72,11 +74,49 @@ RimFishboneWellPathCollection* RimFishbonesCollection::wellPathCollection() cons
//--------------------------------------------------------------------------------------------------
void RimFishbonesCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
if (changedField == &m_startMD)
{
manuallyModifiedStartMD = true;
}
RimProject* proj;
this->firstAncestorOrThisOfTypeAsserted(proj);
proj->createDisplayModelAndRedrawAllViews();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishbonesCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
{
RimWellPath* wellPath;
firstAncestorOrThisOfType(wellPath);
if (wellPath)
{
if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_METRIC)
{
m_startMD.uiCapability()->setUiName("Start MD [m]");
m_mainBoreDiameter.uiCapability()->setUiName("Main Bore Diameter [m]");
m_linerDiameter.uiCapability()->setUiName("Liner Inner Diameter [m]");
m_roughnessFactor.uiCapability()->setUiName("Roughness Factor [m]");
}
else if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_FIELD)
{
m_startMD.uiCapability()->setUiName("Start MD [ft]");
m_mainBoreDiameter.uiCapability()->setUiName("Main Bore Diameter [ft]");
m_linerDiameter.uiCapability()->setUiName("Liner Inner Diameter [ft]");
m_roughnessFactor.uiCapability()->setUiName("Roughness Factor [ft]");
}
}
}
uiOrdering.add(&m_startMD);
uiOrdering.add(&m_mainBoreDiameter);
uiOrdering.add(&m_linerDiameter);
uiOrdering.add(&m_roughnessFactor);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -85,7 +125,8 @@ void RimFishbonesCollection::appendFishbonesSubs(RimFishbonesMultipleSubs* subs)
subs->fishbonesColor = nextFishbonesColor();
fishbonesSubs.push_back(subs);
recalculateStartMD();
subs->setUnitSystemSpecificDefaults();
subs->recomputeLateralLocations();
}
//--------------------------------------------------------------------------------------------------
@ -136,9 +177,97 @@ void RimFishbonesCollection::recalculateStartMD()
}
}
if (minStartMD < m_startMD())
for (const RimFishboneWellPath* wellPath : m_wellPathCollection->wellPaths())
{
if (wellPath->measuredDepths().size() > 0)
{
minStartMD = std::min(minStartMD, wellPath->measuredDepths()[0] - 13.0);
}
}
if (!manuallyModifiedStartMD || minStartMD < m_startMD())
{
m_startMD = minStartMD;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFishbonesCollection::mainBoreDiameter(RiaEclipseUnitTools::UnitSystem unitSystem) const
{
RimWellPath* wellPath;
firstAncestorOrThisOfTypeAsserted(wellPath);
if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_FIELD && unitSystem == RiaEclipseUnitTools::UNITS_METRIC)
{
return RiaEclipseUnitTools::feetToMeter(m_mainBoreDiameter());
}
else if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_METRIC && unitSystem == RiaEclipseUnitTools::UNITS_FIELD)
{
return RiaEclipseUnitTools::meterToFeet(m_mainBoreDiameter());
}
return m_mainBoreDiameter();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFishbonesCollection::linerDiameter(RiaEclipseUnitTools::UnitSystem unitSystem) const
{
RimWellPath* wellPath;
firstAncestorOrThisOfTypeAsserted(wellPath);
if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_FIELD && unitSystem == RiaEclipseUnitTools::UNITS_METRIC)
{
return RiaEclipseUnitTools::feetToMeter(m_linerDiameter());
}
else if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_METRIC && unitSystem == RiaEclipseUnitTools::UNITS_FIELD)
{
return RiaEclipseUnitTools::meterToFeet(m_linerDiameter());
}
return m_linerDiameter();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFishbonesCollection::roughnessFactor(RiaEclipseUnitTools::UnitSystem unitSystem) const
{
RimWellPath* wellPath;
firstAncestorOrThisOfTypeAsserted(wellPath);
if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_FIELD && unitSystem == RiaEclipseUnitTools::UNITS_METRIC)
{
return RiaEclipseUnitTools::feetToMeter(m_roughnessFactor());
}
else if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_METRIC && unitSystem == RiaEclipseUnitTools::UNITS_FIELD)
{
return RiaEclipseUnitTools::meterToFeet(m_roughnessFactor());
}
return m_roughnessFactor();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishbonesCollection::setUnitSystemSpecificDefaults()
{
RimWellPath* wellPath;
firstAncestorOrThisOfType(wellPath);
if (wellPath)
{
if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_METRIC)
{
m_mainBoreDiameter = 0.216;
m_linerDiameter = 0.152;
m_roughnessFactor = 1e-05;
}
else
{
m_mainBoreDiameter = 0.708;
m_linerDiameter = 0.5;
m_roughnessFactor = 3.28e-05;
}
m_wellPathCollection->setUnitSystemSpecificDefaults();
}
}

View File

@ -20,6 +20,8 @@
#include "RimCheckableNamedObject.h"
#include "RiaEclipseUnitTools.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmChildField.h"
#include "cafPdmFieldCvfColor.h"
@ -47,13 +49,16 @@ public:
caf::PdmChildArrayField<RimFishbonesMultipleSubs*> fishbonesSubs;
void recalculateStartMD();
double startMD() const { return m_startMD(); }
double mainBoreDiameter() const { return m_mainBoreDiameter(); }
double linerDiameter() const { return m_linerDiameter(); }
double roughnessFactor() const { return m_roughnessFactor(); }
double startMD() const { return m_startMD; }
double mainBoreDiameter(RiaEclipseUnitTools::UnitSystem unitSystem) const;
double linerDiameter(RiaEclipseUnitTools::UnitSystem unitSystem) const;
double roughnessFactor(RiaEclipseUnitTools::UnitSystem unitSystem) const;
void setUnitSystemSpecificDefaults();
protected:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
private:
cvf::Color3f nextFishbonesColor() const;
@ -65,4 +70,6 @@ private:
caf::PdmField<double> m_mainBoreDiameter;
caf::PdmField<double> m_linerDiameter;
caf::PdmField<double> m_roughnessFactor;
bool manuallyModifiedStartMD;
};

View File

@ -103,8 +103,6 @@ RimFishbonesMultipleSubs::RimFishbonesMultipleSubs()
nameField()->uiCapability()->setUiReadOnly(true);
m_rigFishbonesGeometry = std::unique_ptr<RigFisbonesGeometry>(new RigFisbonesGeometry(this));
computeSubLateralIndices();
}
//--------------------------------------------------------------------------------------------------
@ -128,7 +126,6 @@ void RimFishbonesMultipleSubs::setMeasuredDepthAndCount(double measuredDepth, do
computeRangesAndLocations();
computeRotationAngles();
computeSubLateralIndices();
}
//--------------------------------------------------------------------------------------------------
@ -177,11 +174,88 @@ double RimFishbonesMultipleSubs::buildAngle() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFishbonesMultipleSubs::tubingDiameter() const
double RimFishbonesMultipleSubs::tubingDiameter(RiaEclipseUnitTools::UnitSystem unitSystem) const
{
return m_lateralTubingDiameter;
RimWellPath* wellPath;
firstAncestorOrThisOfTypeAsserted(wellPath);
if (unitSystem == RiaEclipseUnitTools::UNITS_METRIC)
{
if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_FIELD)
{
return RiaEclipseUnitTools::inchToMeter(m_lateralTubingDiameter());
}
else
{
return m_lateralTubingDiameter() / 1000;
}
}
else if (unitSystem == RiaEclipseUnitTools::UNITS_FIELD)
{
if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_METRIC)
{
return RiaEclipseUnitTools::meterToFeet(m_lateralTubingDiameter() / 1000);
}
else
{
return RiaEclipseUnitTools::inchToFeet(m_lateralTubingDiameter());
}
}
CVF_ASSERT(false);
return 0.0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFishbonesMultipleSubs::openHoleRoughnessFactor(RiaEclipseUnitTools::UnitSystem unitSystem) const
{
RimWellPath* wellPath;
firstAncestorOrThisOfTypeAsserted(wellPath);
if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_FIELD && unitSystem == RiaEclipseUnitTools::UNITS_METRIC)
{
return RiaEclipseUnitTools::feetToMeter(m_lateralOpenHoleRoghnessFactor());
}
else if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_METRIC && unitSystem == RiaEclipseUnitTools::UNITS_FIELD)
{
return RiaEclipseUnitTools::meterToFeet(m_lateralOpenHoleRoghnessFactor());
}
return m_lateralOpenHoleRoghnessFactor();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFishbonesMultipleSubs::icdOrificeDiameter(RiaEclipseUnitTools::UnitSystem unitSystem) const
{
RimWellPath* wellPath;
firstAncestorOrThisOfTypeAsserted(wellPath);
if (unitSystem == RiaEclipseUnitTools::UNITS_METRIC)
{
if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_FIELD)
{
return RiaEclipseUnitTools::inchToMeter(m_icdOrificeDiameter());
}
else
{
return m_icdOrificeDiameter() / 1000;
}
}
else if (unitSystem == RiaEclipseUnitTools::UNITS_FIELD)
{
if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_METRIC)
{
return RiaEclipseUnitTools::meterToFeet(m_icdOrificeDiameter() / 1000);
}
else
{
return RiaEclipseUnitTools::inchToFeet(m_icdOrificeDiameter());
}
}
CVF_ASSERT(false);
return 0.0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -233,6 +307,46 @@ std::vector<std::pair<cvf::Vec3d, double>> RimFishbonesMultipleSubs::coordsAndMD
return m_rigFishbonesGeometry->coordsForLateral(subIndex, lateralIndex);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishbonesMultipleSubs::recomputeLateralLocations()
{
computeRangesAndLocations();
computeRotationAngles();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishbonesMultipleSubs::setUnitSystemSpecificDefaults()
{
RimWellPath* wellPath;
firstAncestorOrThisOfType(wellPath);
if (wellPath)
{
if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_METRIC)
{
m_rangeSubSpacing = 13;
m_lateralLength = "11";
m_lateralTubingDiameter = 8;
m_lateralOpenHoleRoghnessFactor = 0.001;
m_lateralTubingRoghnessFactor = 1e-05;
m_icdOrificeDiameter = 7;
}
else if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_FIELD)
{
m_rangeSubSpacing = 42;
m_lateralLength = "36";
m_lateralTubingDiameter = 0.31;
m_lateralOpenHoleRoghnessFactor = 0.0032;
m_lateralTubingRoghnessFactor = 3.28e-05;
m_icdOrificeDiameter = 0.28;
}
m_pipeProperties->setUnitSystemSpecificDefaults();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -275,8 +389,7 @@ void RimFishbonesMultipleSubs::fieldChangedByUi(const caf::PdmFieldHandle* chang
computeRotationAngles();
}
if (recomputeLocations ||
changedField == &m_locationOfSubs ||
if (changedField == &m_locationOfSubs ||
changedField == &m_lateralInstallSuccessFraction ||
changedField == &m_lateralCountPerSub)
{
@ -338,6 +451,7 @@ void RimFishbonesMultipleSubs::computeRangesAndLocations()
RimFishbonesCollection* collection;
this->firstAncestorOrThisOfTypeAsserted(collection);
computeSubLateralIndices();
collection->recalculateStartMD();
}
@ -346,6 +460,44 @@ void RimFishbonesMultipleSubs::computeRangesAndLocations()
//--------------------------------------------------------------------------------------------------
void RimFishbonesMultipleSubs::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
{
RimWellPath* wellPath;
firstAncestorOrThisOfType(wellPath);
if (wellPath)
{
if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_METRIC)
{
m_lateralLength.uiCapability()->setUiName("Length(s) [m]");
m_lateralBuildAngle.uiCapability()->setUiName("Build Angle [deg/m]");
m_lateralTubingDiameter.uiCapability()->setUiName("Tubing Diameter [mm]");
m_lateralOpenHoleRoghnessFactor.uiCapability()->setUiName("Open Hole Roughness Factor [m]");
m_lateralTubingRoghnessFactor.uiCapability()->setUiName("Tubing Roughness Factor [m]");
m_icdOrificeDiameter.uiCapability()->setUiName("ICD Orifice Diameter [mm]");
m_locationOfSubs.uiCapability()->setUiName("Measured Depths [m]");
m_rangeStart.uiCapability()->setUiName("Start MD [m]");
m_rangeEnd.uiCapability()->setUiName("End MD [m]");
m_rangeSubSpacing.uiCapability()->setUiName("Spacing [m]");
}
else if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_FIELD)
{
m_lateralLength.uiCapability()->setUiName("Length(s) [ft]");
m_lateralBuildAngle.uiCapability()->setUiName("Build Angle [deg/ft]");
m_lateralTubingDiameter.uiCapability()->setUiName("Tubing Diameter [in]");
m_lateralOpenHoleRoghnessFactor.uiCapability()->setUiName("Open Hole Roughness Factor [ft]");
m_lateralTubingRoghnessFactor.uiCapability()->setUiName("Tubing Roughness Factor [ft]");
m_icdOrificeDiameter.uiCapability()->setUiName("ICD Orifice Diameter [in]");
m_locationOfSubs.uiCapability()->setUiName("Measured Depths [ft]");
m_rangeStart.uiCapability()->setUiName("Start MD [ft]");
m_rangeEnd.uiCapability()->setUiName("End MD [ft]");
m_rangeSubSpacing.uiCapability()->setUiName("Spacing [ft]");
}
}
}
{
caf::PdmUiGroup* group = uiOrdering.addNewGroup("Appearance");

View File

@ -22,6 +22,8 @@
#include "Rim3dPropertiesInterface.h"
#include "RimFishbonesPipeProperties.h"
#include "RiaEclipseUnitTools.h"
#include "cvfBase.h"
#include "cvfVector3.h"
#include "cvfColor3.h"
@ -79,19 +81,21 @@ public:
double exitAngle() const;
double buildAngle() const;
double tubingDiameter() const;
double holeDiameter() const { return m_pipeProperties()->holeDiameter(); }
double tubingDiameter(RiaEclipseUnitTools::UnitSystem unitSystem) const;
double holeDiameter(RiaEclipseUnitTools::UnitSystem unitSystem) const { return m_pipeProperties()->holeDiameter(unitSystem); }
double skinFactor() const { return m_pipeProperties()->skinFactor(); }
double openHoleRoughnessFactor() const { return m_lateralOpenHoleRoghnessFactor(); }
double icdOrificeDiameter() const { return m_icdOrificeDiameter(); }
double openHoleRoughnessFactor(RiaEclipseUnitTools::UnitSystem unitSystem) const;
double icdOrificeDiameter(RiaEclipseUnitTools::UnitSystem unitSystem) const;
double icdFlowCoefficient() const { return m_icdFlowCoefficient(); }
size_t icdCount() const { return m_icdCount(); }
std::vector<double> lateralLengths() const;
const std::vector<SubLateralIndex>& installedLateralIndices() const { return m_subLateralIndices; };
const std::vector<SubLateralIndex>& installedLateralIndices() const { return m_subLateralIndices; };
std::vector<cvf::Vec3d> coordsForLateral(size_t subIndex, size_t lateralIndex) const;
std::vector<std::pair<cvf::Vec3d, double>> coordsAndMDForLateral(size_t subIndex, size_t lateralIndex) const;
void recomputeLateralLocations();
void setUnitSystemSpecificDefaults();
// Override from Rim3dPropertiesInterface
virtual cvf::BoundingBox boundingBoxInDomainCoords() override;

View File

@ -18,6 +18,8 @@
#include "RimFishbonesPipeProperties.h"
#include "RimWellPath.h"
#include <cstdlib>
@ -31,7 +33,7 @@ RimFishbonesPipeProperties::RimFishbonesPipeProperties()
CAF_PDM_InitObject("FishbonesPipeProperties", "", "", "");
CAF_PDM_InitField(&m_lateralHoleDiameter, "LateralHoleDiameter", 12.5, "Hole Diameter [mm]", "", "", "");
CAF_PDM_InitField(&m_skinFactor, "SkinFactor", 1.0, "Skin Factor [0..1]", "", "", "");
CAF_PDM_InitField(&m_skinFactor, "SkinFactor", 0.0, "Skin Factor [0..1]", "", "", "");
}
//--------------------------------------------------------------------------------------------------
@ -42,11 +44,80 @@ RimFishbonesPipeProperties::~RimFishbonesPipeProperties()
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFishbonesPipeProperties::holeDiameter(RiaEclipseUnitTools::UnitSystem unitSystem) const
{
RimWellPath* wellPath;
firstAncestorOrThisOfTypeAsserted(wellPath);
if (unitSystem == RiaEclipseUnitTools::UNITS_METRIC)
{
if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_FIELD)
{
return RiaEclipseUnitTools::inchToMeter(m_lateralHoleDiameter());
}
else
{
return m_lateralHoleDiameter() / 1000;
}
}
else if (unitSystem == RiaEclipseUnitTools::UNITS_FIELD)
{
if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_METRIC)
{
return RiaEclipseUnitTools::meterToFeet(m_lateralHoleDiameter() / 1000);
}
else
{
return RiaEclipseUnitTools::inchToFeet(m_lateralHoleDiameter());
}
}
CVF_ASSERT(false);
return 0.0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishbonesPipeProperties::setUnitSystemSpecificDefaults()
{
RimWellPath* wellPath;
firstAncestorOrThisOfType(wellPath);
if (wellPath)
{
if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_METRIC)
{
m_lateralHoleDiameter = 12.5;
}
else if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_FIELD)
{
m_lateralHoleDiameter = 0.5;
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishbonesPipeProperties::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering & uiOrdering)
{
{
RimWellPath* wellPath;
firstAncestorOrThisOfType(wellPath);
if (wellPath)
{
if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_METRIC)
{
m_lateralHoleDiameter.uiCapability()->setUiName("Hole Diameter [mm]");
}
else if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_FIELD)
{
m_lateralHoleDiameter.uiCapability()->setUiName("Hole Diameter [in]");
}
}
}
uiOrdering.add(&m_lateralHoleDiameter);
uiOrdering.add(&m_skinFactor);
}

View File

@ -18,6 +18,8 @@
#pragma once
#include "RiaEclipseUnitTools.h"
#include "cvfBase.h"
#include "cvfVector3.h"
#include "cvfColor3.h"
@ -41,7 +43,9 @@ public:
virtual ~RimFishbonesPipeProperties();
double skinFactor() const { return m_skinFactor(); }
double holeDiameter() const { return m_lateralHoleDiameter(); }
double holeDiameter(RiaEclipseUnitTools::UnitSystem unitSystem) const;
void setUnitSystemSpecificDefaults();
protected:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;

View File

@ -72,6 +72,8 @@ void RimPerforationCollection::appendPerforation(RimPerforationInterval* perfora
{
m_perforations.push_back(perforation);
perforation->setUnitSystemSpecificDefaults();
updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(perforation);

View File

@ -40,10 +40,10 @@ public:
RimPerforationCollection();
~RimPerforationCollection();
void appendPerforation(RimPerforationInterval* perforation);
void appendPerforation(RimPerforationInterval* perforation);
std::vector<const RimPerforationInterval*> perforations() const;
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
friend class RiuEditPerforationCollectionWidget;

View File

@ -25,9 +25,7 @@
#include "RimProject.h"
#include "RimWellPath.h"
#include "cafPdmUiListEditor.h"
#include "cafPdmUiTextEditor.h"
#include "cafPdmUiLineEditor.h"
#include "cafPdmUiDateEditor.h"
CAF_PDM_SOURCE_INIT(RimPerforationInterval, "Perforation");
@ -38,13 +36,12 @@ RimPerforationInterval::RimPerforationInterval()
{
CAF_PDM_InitObject("Perforation", ":/PerforationInterval16x16.png", "", "");
CAF_PDM_InitField(&m_startMD, "StartMeasuredDepth", 0.0, "Start MD [m]", "", "", "");
CAF_PDM_InitField(&m_endMD, "EndMeasuredDepth", 0.0, "End MD [m]", "", "", "");
CAF_PDM_InitField(&m_diameter, "Diameter", 0.216, "Diameter [m]", "", "", "");
CAF_PDM_InitField(&m_skinFactor, "SkinFactor", 0.0, "Skin Factor", "", "", "");
CAF_PDM_InitField(&m_startOfHistory, "StartOfHistory", true, "Start of History", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_date, "StartDate", "Start Date", "", "", "");
m_date.uiCapability()->setUiEditorTypeName(caf::PdmUiLineEditor::uiEditorTypeName());
CAF_PDM_InitField(&m_startMD, "StartMeasuredDepth", 0.0, "Start MD", "", "", "");
CAF_PDM_InitField(&m_endMD, "EndMeasuredDepth", 0.0, "End MD", "", "", "");
CAF_PDM_InitField(&m_diameter, "Diameter", 0.216, "Diameter", "", "", "");
CAF_PDM_InitField(&m_skinFactor, "SkinFactor", 0.0, "Skin Factor", "", "", "");
CAF_PDM_InitField(&m_startOfHistory, "StartOfHistory", true, "Start of History", "", "", "");
CAF_PDM_InitField(&m_date, "StartDate", QDateTime::currentDateTime(), "Start Date", "", "", "");
nameField()->uiCapability()->setUiReadOnly(true);
}
@ -100,6 +97,24 @@ void RimPerforationInterval::setSkinFactor(double skinFactor)
m_skinFactor = skinFactor;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimPerforationInterval::diameter(RiaEclipseUnitTools::UnitSystem unitSystem) const
{
RimWellPath* wellPath;
firstAncestorOrThisOfTypeAsserted(wellPath);
if (unitSystem == RiaEclipseUnitTools::UNITS_METRIC && wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_FIELD)
{
return RiaEclipseUnitTools::feetToMeter(m_diameter());
}
else if (unitSystem == RiaEclipseUnitTools::UNITS_FIELD && wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_METRIC)
{
return RiaEclipseUnitTools::meterToFeet(m_diameter());
}
return m_diameter();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -132,6 +147,26 @@ cvf::BoundingBox RimPerforationInterval::boundingBoxInDomainCoords()
return bb;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPerforationInterval::setUnitSystemSpecificDefaults()
{
RimWellPath* wellPath;
firstAncestorOrThisOfType(wellPath);
if (wellPath)
{
if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_METRIC)
{
m_diameter = 0.216;
}
else if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_FIELD)
{
m_diameter = 0.709;
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -161,6 +196,25 @@ void RimPerforationInterval::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTree
//--------------------------------------------------------------------------------------------------
void RimPerforationInterval::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
{
RimWellPath* wellPath;
firstAncestorOrThisOfType(wellPath);
if (wellPath)
{
if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_METRIC)
{
m_startMD.uiCapability()->setUiName("Start MD [m]");
m_endMD.uiCapability()->setUiName("End MD [m]");
m_diameter.uiCapability()->setUiName("Diameter [m]");
}
else if (wellPath->unitSystem() == RiaEclipseUnitTools::UNITS_FIELD)
{
m_startMD.uiCapability()->setUiName("Start MD [ft]");
m_endMD.uiCapability()->setUiName("End MD [ft]");
m_diameter.uiCapability()->setUiName("Diameter [ft]");
}
}
}
m_date.uiCapability()->setUiReadOnly(m_startOfHistory());
uiOrdering.add(&m_startMD);
@ -173,3 +227,18 @@ void RimPerforationInterval::defineUiOrdering(QString uiConfigName, caf::PdmUiOr
uiOrdering.skipRemainingFields();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPerforationInterval::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
{
if (field == &m_date)
{
caf::PdmUiDateEditorAttribute* myAttr = static_cast<caf::PdmUiDateEditorAttribute*>(attribute);
if (myAttr)
{
myAttr->dateFormat = "dd MMM yyyy";
}
}
}

View File

@ -22,6 +22,8 @@
#include "RimCheckableNamedObject.h"
#include "Rim3dPropertiesInterface.h"
#include "RiaEclipseUnitTools.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
@ -45,17 +47,20 @@ public:
void setSkinFactor(double skinFactor);
double startMD() const { return m_startMD(); }
double endMD() const { return m_endMD(); }
double diameter() const { return m_diameter(); }
double diameter(RiaEclipseUnitTools::UnitSystem unitSystem) const;
double skinFactor() const { return m_skinFactor(); }
bool isActiveOnDate(const QDateTime& date) const;
virtual cvf::BoundingBox boundingBoxInDomainCoords() override;
void setUnitSystemSpecificDefaults();
protected:
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override;
private:
caf::PdmField< double > m_startMD;

View File

@ -19,11 +19,14 @@
#include "RimWellPathCompletions.h"
#include "RimFishbonesCollection.h"
#include "RimFishboneWellPathCollection.h"
#include "RimPerforationCollection.h"
#include "RimWellPathFractureCollection.h"
#include "cvfAssert.h"
#include "cafPdmUiTreeOrdering.h"
CAF_PDM_SOURCE_INIT(RimWellPathCompletions, "WellPathCompletions");
@ -94,3 +97,40 @@ RimWellPathFractureCollection* RimWellPathCompletions::fractureCollection() cons
return m_fractureCollection;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellPathCompletions::hasCompletions() const
{
return !fishbonesCollection()->fishbonesSubs().empty() ||
!fishbonesCollection()->wellPathCollection()->wellPaths().empty() ||
!perforationCollection()->perforations().empty();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletions::setUnitSystemSpecificDefaults()
{
m_fishbonesCollection->setUnitSystemSpecificDefaults();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletions::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName)
{
uiTreeOrdering.skipRemainingChildren(true);
if (!perforationCollection()->perforations().empty())
{
uiTreeOrdering.add(&m_perforationCollection);
}
if (!fishbonesCollection()->fishbonesSubs().empty() ||
!fishbonesCollection()->wellPathCollection()->wellPaths().empty())
{
uiTreeOrdering.add(&m_fishbonesCollection);
}
}

View File

@ -43,6 +43,12 @@ public:
void setWellNameForExport(const QString& name);
QString wellNameForExport() const;
bool hasCompletions() const;
void setUnitSystemSpecificDefaults();
protected:
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) override;
private:
caf::PdmChildField<RimFishbonesCollection*> m_fishbonesCollection;

View File

@ -356,7 +356,7 @@ std::map<QString, const std::vector<double> *> RimWellAllocationPlot::findReleva
//--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::updateWellFlowPlotXAxisTitle(RimWellLogTrack* plotTrack)
{
RigEclipseCaseData::UnitsType unitSet = m_case->eclipseCaseData()->unitsType();
RiaEclipseUnitTools::UnitSystem unitSet = m_case->eclipseCaseData()->unitsType();
if (m_flowDiagSolution)
@ -364,13 +364,13 @@ void RimWellAllocationPlot::updateWellFlowPlotXAxisTitle(RimWellLogTrack* plotTr
QString unitText;
switch ( unitSet )
{
case RigEclipseCaseData::UNITS_METRIC:
case RiaEclipseUnitTools::UNITS_METRIC:
unitText = "[m<sup>3</sup>/day]";
break;
case RigEclipseCaseData::UNITS_FIELD:
case RiaEclipseUnitTools::UNITS_FIELD:
unitText = "[Brl/day]";
break;
case RigEclipseCaseData::UNITS_LAB:
case RiaEclipseUnitTools::UNITS_LAB:
unitText = "[cm<sup>3</sup>/hr]";
break;
default:
@ -384,13 +384,13 @@ void RimWellAllocationPlot::updateWellFlowPlotXAxisTitle(RimWellLogTrack* plotTr
QString unitText;
switch ( unitSet )
{
case RigEclipseCaseData::UNITS_METRIC:
case RiaEclipseUnitTools::UNITS_METRIC:
unitText = "[Liquid Sm<sup>3</sup>/day], [Gas kSm<sup>3</sup>/day]";
break;
case RigEclipseCaseData::UNITS_FIELD:
case RiaEclipseUnitTools::UNITS_FIELD:
unitText = "[Liquid BBL/day], [Gas BOE/day]";
break;
case RigEclipseCaseData::UNITS_LAB:
case RiaEclipseUnitTools::UNITS_LAB:
unitText = "[cm<sup>3</sup>/hr]";
break;
default:

View File

@ -93,12 +93,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
std::vector<caf::PdmUiItem*> uiItems;
caf::SelectionManager::instance()->selectedItems(uiItems);
if (uiItems.size() == 0)
{
commandIds << "RicNewWellLogPlotFeature";
commandIds << "RicNewSummaryPlotFeature";
}
else if (uiItems.size() == 1)
if (uiItems.size() == 1)
{
caf::PdmUiItem* uiItem = uiItems[0];
CVF_ASSERT(uiItem);

View File

@ -1568,7 +1568,7 @@ double RimReservoirCellResultsStorage::darchysValue()
if (rimCase && rimCase->eclipseCaseData())
{
darchy = rimCase->eclipseCaseData()->darchysValue();
darchy = RiaEclipseUnitTools::darcysConstant(rimCase->eclipseCaseData()->unitsType());
}
return darchy;

View File

@ -349,8 +349,8 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate()
eclExtractor->curveData(resAcc.p(), &values);
}
RigEclipseCaseData::UnitsType eclipseUnitsType = eclipseCase->eclipseCaseData()->unitsType();
if (eclipseUnitsType == RigEclipseCaseData::UNITS_FIELD)
RiaEclipseUnitTools::UnitSystem eclipseUnitsType = eclipseCase->eclipseCaseData()->unitsType();
if (eclipseUnitsType == RiaEclipseUnitTools::UNITS_FIELD)
{
// See https://github.com/OPM/ResInsight/issues/538

View File

@ -386,7 +386,12 @@ void RimWellPath::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiO
void RimWellPath::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName)
{
uiTreeOrdering.add(&m_wellLogFile);
uiTreeOrdering.add(&m_completions);
if (m_completions->hasCompletions())
{
uiTreeOrdering.add(&m_completions);
}
uiTreeOrdering.skipRemainingChildren(true);
}
@ -500,6 +505,8 @@ double RimWellPath::combinedScaleFactor() const
void RimWellPath::setUnitSystem(RiaEclipseUnitTools::UnitSystem unitSystem)
{
m_unitSystem = unitSystem;
m_completions->setUnitSystemSpecificDefaults();
}
//--------------------------------------------------------------------------------------------------

View File

@ -440,14 +440,7 @@ RiaEclipseUnitTools::UnitSystemType RimWellPathCollection::findUnitSystemForWell
if (caseBoundingBox.intersects(wellPathBoundingBox))
{
if (eclipseCaseData->unitsType() == RigEclipseCaseData::UNITS_FIELD)
{
return RiaEclipseUnitTools::UNITS_FIELD;
}
else if (eclipseCaseData->unitsType() == RigEclipseCaseData::UNITS_METRIC)
{
return RiaEclipseUnitTools::UNITS_METRIC;
}
return eclipseCaseData->unitsType();
}
return RiaEclipseUnitTools::UNITS_UNKNOWN;
}

View File

@ -21,7 +21,8 @@
#include "RiaLogging.h"
#include <QString>
#include <cmath> // Needed for HUGE_VAL on linux
#include <cmath> // Needed for HUGE_VAL on Linux
//==================================================================================================
///
@ -37,7 +38,10 @@ RigCompletionData::RigCompletionData(const QString wellName, const IJKCellIndex&
m_dFactor(HUGE_VAL),
m_direction(DIR_UNDEF),
m_connectionState(OPEN),
m_count(1)
m_count(1),
m_wpimult(1),
m_isMainBore(false),
m_readyForExport(false)
{
}
@ -59,25 +63,36 @@ RigCompletionData::RigCompletionData(const RigCompletionData& other)
//==================================================================================================
///
//==================================================================================================
RigCompletionData RigCompletionData::combine(const RigCompletionData& first, const RigCompletionData& second)
RigCompletionData RigCompletionData::combine(const std::vector<RigCompletionData>& completions)
{
RigCompletionData result(first);
CVF_ASSERT(result.m_wellName == second.m_wellName);
CVF_ASSERT(result.m_cellIndex == second.m_cellIndex);
CVF_ASSERT(!completions.empty());
if (onlyOneIsDefaulted(result.m_transmissibility, second.m_transmissibility))
auto it = completions.cbegin();
RigCompletionData result(*it);
++it;
for (; it != completions.cend(); ++it)
{
RiaLogging::error("Transmissibility defaulted in one but not both, will produce erroneous result");
}
else
{
result.m_transmissibility += second.m_transmissibility;
}
if (it->completionType() != result.completionType())
{
RiaLogging::error(QString("Cannot combine completions of different types in same cell [%1, %2, %3]").arg(result.m_cellIndex.i).arg(result.m_cellIndex.j).arg(result.m_cellIndex.k));
continue;
}
if (onlyOneIsDefaulted(result.m_transmissibility, it->m_transmissibility))
{
RiaLogging::error("Transmissibility defaulted in one but not both, will produce erroneous result");
}
else
{
result.m_transmissibility += it->m_transmissibility;
}
result.m_metadata.reserve(result.m_metadata.size() + second.m_metadata.size());
result.m_metadata.insert(result.m_metadata.end(), second.m_metadata.begin(), second.m_metadata.end());
result.m_metadata.reserve(result.m_metadata.size() + it->m_metadata.size());
result.m_metadata.insert(result.m_metadata.end(), it->m_metadata.begin(), it->m_metadata.end());
result.m_count += second.m_count;
//TODO: remove?
result.m_count += it->m_count;
}
return result;
}
@ -112,6 +127,7 @@ RigCompletionData& RigCompletionData::operator=(const RigCompletionData& other)
//==================================================================================================
void RigCompletionData::setFromFracture(double transmissibility, double skinFactor)
{
m_completionType = FRACTURE;
m_transmissibility = transmissibility;
m_skinFactor = skinFactor;
}
@ -119,28 +135,59 @@ void RigCompletionData::setFromFracture(double transmissibility, double skinFact
//==================================================================================================
///
//==================================================================================================
void RigCompletionData::setFromFishbone(double diameter, CellDirection direction)
{
m_diameter = diameter;
m_direction = direction;
}
//==================================================================================================
///
//==================================================================================================
void RigCompletionData::setFromFishbone(double transmissibility, double skinFactor)
void RigCompletionData::setTransAndWPImultBackgroundDataFromFishbone(double transmissibility,
double skinFactor,
double diameter,
CellDirection direction)
{
m_completionType = FISHBONES;
m_transmissibility = transmissibility;
m_skinFactor = skinFactor;
m_diameter = diameter;
m_direction = direction;
}
//==================================================================================================
///
//==================================================================================================
void RigCompletionData::setFromPerforation(double diameter, CellDirection direction)
void RigCompletionData::setTransAndWPImultBackgroundDataFromPerforation(double transmissibility,
double skinFactor,
double diameter,
CellDirection direction)
{
m_completionType = PERFORATION;
m_transmissibility = transmissibility;
m_skinFactor = skinFactor;
m_diameter = diameter;
m_direction = direction;
m_isMainBore = true;
}
//==================================================================================================
///
//==================================================================================================
void RigCompletionData::setCombinedValuesExplicitTrans(double transmissibility,
CompletionType completionType)
{
m_completionType = completionType;
m_transmissibility = transmissibility;
m_readyForExport = true;
}
//==================================================================================================
///
//==================================================================================================
void RigCompletionData::setCombinedValuesImplicitTransWPImult(double wpimult,
CellDirection celldirection,
double skinFactor,
double wellDiameter,
CompletionType completionType)
{
m_wpimult = wpimult;
m_completionType = completionType;
m_skinFactor = skinFactor;
m_diameter = wellDiameter;
m_readyForExport = true;
}
//==================================================================================================
@ -204,4 +251,5 @@ void RigCompletionData::copy(RigCompletionData& target, const RigCompletionData&
target.m_dFactor = from.m_dFactor;
target.m_direction = from.m_direction;
target.m_count = from.m_count;
target.m_completionType = from.m_completionType;
}

View File

@ -91,19 +91,40 @@ struct RigCompletionMetaData {
class RigCompletionData : public cvf::Object
{
public:
enum CompletionType {
FISHBONES,
FRACTURE,
PERFORATION,
};
RigCompletionData(const QString wellName, const IJKCellIndex& cellIndex);
~RigCompletionData();
RigCompletionData(const RigCompletionData& other);
static RigCompletionData combine(const RigCompletionData& first, const RigCompletionData& second);
static RigCompletionData combine(const std::vector<RigCompletionData>& completions);
bool operator<(const RigCompletionData& other) const;
RigCompletionData& operator=(const RigCompletionData& other);
void setFromFracture(double transmissibility, double skinFactor);
void setFromFishbone(double diameter, CellDirection direction);
void setFromFishbone(double transmissibility, double skinFactor);
void setFromPerforation(double diameter, CellDirection direction);
void setTransAndWPImultBackgroundDataFromFishbone(double transmissibility,
double skinFactor,
double diameter,
CellDirection direction);
void setTransAndWPImultBackgroundDataFromPerforation(double transmissibility,
double skinFactor,
double diameter,
CellDirection direction);
void setCombinedValuesExplicitTrans(double transmissibility,
CompletionType completionType);
void setCombinedValuesImplicitTransWPImult(double wpimult,
CellDirection celldirection,
double skinFactor,
double wellDiameter,
CompletionType completionType);
void addMetadata(const QString& name, const QString& comment);
static bool isDefaultValue(double val);
@ -113,28 +134,37 @@ public:
WellConnectionState connectionState() const { return m_connectionState; }
double saturation() const { return m_saturation; }
double transmissibility() const { return m_transmissibility; }
double diameter() const { return m_diameter; }
double diameter() const { return m_diameter; } //TODO: should be ft or m
double kh() const { return m_kh; }
double skinFactor() const { return m_skinFactor; }
double dFactor() const { return m_dFactor; }
CellDirection direction() const { return m_direction; }
size_t count() const { return m_count; }
CompletionType completionType() const { return m_completionType; }
bool isMainBore() const { return m_isMainBore; }
bool readyForExport() const { return m_readyForExport; }
private:
std::vector<RigCompletionMetaData> m_metadata;
QString m_wellName;
IJKCellIndex m_cellIndex;
WellConnectionState m_connectionState;
double m_saturation;
double m_saturation; //TODO: remove, always use default in Eclipse?
double m_transmissibility;
double m_diameter;
double m_kh;
double m_kh; //TODO: Remove, always use default in Eclipse?
double m_skinFactor;
double m_dFactor;
double m_dFactor; //TODO: Remove, always use default in Eclipse?
CellDirection m_direction;
// Number of parts that have contributed to this completion
size_t m_count;
bool m_isMainBore; //to use mainbore for Eclipse calculation
bool m_readyForExport;
size_t m_count; //TODO: Remove, usage replaced by WPImult
size_t m_wpimult;
CompletionType m_completionType;
private:
static bool onlyOneIsDefaulted(double first, double second);

View File

@ -45,7 +45,7 @@ RigEclipseCaseData::RigEclipseCaseData()
m_matrixModelResults->setActiveCellInfo(m_activeCellInfo.p());
m_fractureModelResults->setActiveCellInfo(m_fractureActiveCellInfo.p());
m_unitsType = UNITS_METRIC;
m_unitsType = RiaEclipseUnitTools::UNITS_METRIC;
}
//--------------------------------------------------------------------------------------------------
@ -431,43 +431,6 @@ void RigEclipseCaseData::computeActiveCellBoundingBoxes()
computeActiveCellsGeometryBoundingBox();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigEclipseCaseData::darchysValue() const
{
// See "Cartesian transmissibility calculations" in the "Eclipse Technical Description"
// CDARCY Darcys constant
// = 0.00852702 (E300); 0.008527 (ECLIPSE 100) (METRIC)
// = 0.00112712 (E300); 0.001127 (ECLIPSE 100) (FIELD)
// = 3.6 (LAB)
// = 0.00864 (PVT - M)
double darchy = 0.008527; // (ECLIPSE 100) (METRIC)
RigEclipseCaseData::UnitsType unitsType = this->unitsType();
if ( unitsType == RigEclipseCaseData::UNITS_FIELD )
{
darchy = 0.001127;
}
else if ( unitsType == RigEclipseCaseData::UNITS_METRIC )
{
darchy = 0.008527;
}
else if ( unitsType == RigEclipseCaseData::UNITS_LAB )
{
darchy = 3.6;
}
else
{
darchy = 0.00864; // Assuming (PVT - M)
CVF_TIGHT_ASSERT(false); // The enum and doc does not state that the PVT-M actually exists, so to trap this in debug
}
return darchy;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -23,6 +23,8 @@
#include "RifReaderInterface.h"
#include "RiaEclipseUnitTools.h"
#include "cvfAssert.h"
#include "cvfArray.h"
#include "cvfObject.h"
@ -48,14 +50,6 @@ struct RigWellResultPoint;
//--------------------------------------------------------------------------------------------------
class RigEclipseCaseData : public cvf::Object
{
public:
enum UnitsType
{
UNITS_METRIC,
UNITS_FIELD,
UNITS_LAB
};
public:
RigEclipseCaseData();
~RigEclipseCaseData();
@ -92,9 +86,8 @@ public:
void computeActiveCellBoundingBoxes();
UnitsType unitsType() const { return m_unitsType; }
void setUnitsType(UnitsType unitsType) { m_unitsType = unitsType; }
double darchysValue() const;
RiaEclipseUnitTools::UnitSystem unitsType() const { return m_unitsType; }
void setUnitsType(RiaEclipseUnitTools::UnitSystem unitsType) { m_unitsType = unitsType; }
private:
void computeActiveCellIJKBBox();
@ -113,8 +106,8 @@ private:
cvf::ref<RigFormationNames> m_activeFormationNamesData;
cvf::Collection<RigSingleWellResultsData> m_wellResults; //< A WellResults object for each well in the reservoir
cvf::Collection<cvf::UByteArray> m_wellCellsInGrid; //< A bool array pr grid with one bool pr cell telling wether the cell is a well cell or not
cvf::Collection<cvf::UByteArray> m_wellCellsInGrid; //< A bool array pr grid with one bool pr cell telling whether the cell is a well cell or not
cvf::Collection<cvf::UIntArray> m_gridCellToResultWellIndex; //< Array pr grid with index to well pr cell telling which well a cell is in
UnitsType m_unitsType;
RiaEclipseUnitTools::UnitSystem m_unitsType;
};

View File

@ -23,6 +23,7 @@ set( QOBJECT_HEADERS
cafPdmUiCheckBoxTristateEditor.h
cafPdmUiColorEditor.h
cafPdmUiComboBoxEditor.h
cafPdmUiDateEditor.h
cafPdmUiDefaultObjectEditor.h
cafPdmUiDoubleSliderEditor.h
cafPdmUiFilePathEditor.h
@ -64,6 +65,8 @@ set( PROJECT_FILES
cafPdmUiColorEditor.h
cafPdmUiComboBoxEditor.cpp
cafPdmUiComboBoxEditor.h
cafPdmUiDateEditor.cpp
cafPdmUiDateEditor.h
cafPdmUiDoubleSliderEditor.cpp
cafPdmUiDoubleSliderEditor.h
cafPdmUiDragDropInterface.h

View File

@ -0,0 +1,131 @@
//##################################################################################################
//
// Custom Visualization Core library
// Copyright (C) 2017 Ceetron Solutions AS
//
// This library may be used under the terms of either the GNU General Public License or
// the GNU Lesser General Public License as follows:
//
// GNU General Public License Usage
// This library 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.
//
// This library 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.
//
// GNU Lesser General Public License Usage
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library 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 Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
// for more details.
//
//##################################################################################################
#include "cafPdmUiDateEditor.h"
#include "cafFactory.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmUiDefaultObjectEditor.h"
#include "cafPdmUiFieldEditorHandle.h"
#include "cafPdmUiOrdering.h"
#include "cafSelectionManager.h"
#include <QApplication>
#include <QDate>
#include <QGridLayout>
#include <QIntValidator>
#include <QLabel>
#include <QLineEdit>
#include <QMainWindow>
#include <QMessageBox>
#include <QPalette>
#include <QStatusBar>
#include <QString>
namespace caf
{
CAF_PDM_UI_FIELD_EDITOR_SOURCE_INIT(PdmUiDateEditor);
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void PdmUiDateEditor::configureAndUpdateUi(const QString& uiConfigName)
{
CAF_ASSERT(!m_dateEdit.isNull());
QIcon ic = field()->uiIcon(uiConfigName);
if (!ic.isNull())
{
m_label->setPixmap(ic.pixmap(ic.actualSize(QSize(64, 64))));
}
else
{
m_label->setText(field()->uiName(uiConfigName));
}
m_label->setEnabled(!field()->isUiReadOnly(uiConfigName));
m_dateEdit->setEnabled(!field()->isUiReadOnly(uiConfigName));
caf::PdmUiObjectHandle* uiObject = uiObj(field()->fieldHandle()->ownerObject());
if (uiObject)
{
uiObject->editorAttribute(field()->fieldHandle(), uiConfigName, &m_attributes);
}
if (!m_attributes.dateFormat.isEmpty())
{
m_dateEdit->setDisplayFormat(m_attributes.dateFormat);
}
m_dateEdit->setDate(field()->uiValue().toDate());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiDateEditor::createEditorWidget(QWidget* parent)
{
m_dateEdit = new QDateEdit(parent);
m_dateEdit->setCalendarPopup(true);
connect(m_dateEdit, SIGNAL(editingFinished()), this, SLOT(slotEditingFinished()));
return m_dateEdit;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* PdmUiDateEditor::createLabelWidget(QWidget* parent)
{
m_label = new QLabel(parent);
return m_label;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void PdmUiDateEditor::slotEditingFinished()
{
this->setValueToField(m_dateEdit->date());
}
} // end namespace caf

View File

@ -0,0 +1,93 @@
//##################################################################################################
//
// Custom Visualization Core library
// Copyright (C) 2017 Ceetron Solutions AS
//
// This library may be used under the terms of either the GNU General Public License or
// the GNU Lesser General Public License as follows:
//
// GNU General Public License Usage
// This library 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.
//
// This library 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.
//
// GNU Lesser General Public License Usage
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library 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 Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
// for more details.
//
//##################################################################################################
#pragma once
#include "cafPdmUiFieldEditorHandle.h"
#include <QDateEdit>
#include <QLabel>
#include <QPointer>
#include <QString>
#include <QWidget>
namespace caf
{
//==================================================================================================
///
//==================================================================================================
class PdmUiDateEditorAttribute : public PdmUiEditorAttribute
{
public:
QString dateFormat;
public:
PdmUiDateEditorAttribute()
{
}
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class PdmUiDateEditor : public PdmUiFieldEditorHandle
{
Q_OBJECT
CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT;
public:
PdmUiDateEditor() {}
virtual ~PdmUiDateEditor() {}
protected:
virtual QWidget* createEditorWidget(QWidget * parent);
virtual QWidget* createLabelWidget(QWidget * parent);
virtual void configureAndUpdateUi(const QString& uiConfigName);
protected slots:
void slotEditingFinished();
private:
QPointer<QDateEdit> m_dateEdit;
QPointer<QLabel> m_label;
PdmUiDateEditorAttribute m_attributes;
};
} // end namespace caf

View File

@ -46,9 +46,12 @@
#include "cafPdmUiLineEditor.h"
#include "cafPdmUiListEditor.h"
#include "cafPdmUiOrdering.h"
#include "cafPdmUiDateEditor.h"
#include <QGridLayout>
#include <QWidget>
#include <QDate>
#include <QDateTime>
@ -59,6 +62,8 @@ namespace caf
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiCheckBoxEditor, bool);
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiLineEditor, QString);
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiDateEditor, QDate);
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiDateEditor, QDateTime);
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiLineEditor, int);
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiLineEditor, double);
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiLineEditor, float);