Merge branch 'dev' into well-path-restructure

This commit is contained in:
Jacob Støren 2017-06-20 16:49:28 +02:00
commit 0826db99f8
38 changed files with 1189 additions and 279 deletions

View File

@ -28,8 +28,8 @@ public:
{
UNITS_METRIC,
UNITS_FIELD,
UNITS_LAB,
UNITS_UNKNOWN,
//UNITS_LAB
};
typedef caf::AppEnum< RiaEclipseUnitTools::UnitSystem > UnitSystemType;
@ -41,6 +41,7 @@ public:
static double feetToMeter(double feet) { return feet*meterPerFeet();}
static double meterToInch(double meter) { return meter*feetPerMeter()*12; }
static double inchToMeter(double inch) { return (inch / 12)*meterPerFeet(); }
static double inchToFeet(double inch) { return inch / 12.0; }
static double darcysConstant(UnitSystem unitSystem);

View File

@ -185,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();
@ -246,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);
@ -255,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;
@ -269,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);
@ -277,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)
@ -299,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);
@ -307,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();
}
}
@ -383,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 = {
@ -399,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

@ -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,64 @@ std::vector<RigCompletionData> RicFishbonesTransmissibilityCalculationFeatureImp
bool cellIsActive = activeCellInfo->isActive(cellIndex);
if (!cellIsActive) continue;
size_t NumberOfCellContributions = wellBoreParts.size();
//Simplest implementation possible, this can be improved later
QString directionToSplitCellVolume = "DX";
//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);
}
}
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,
wellBorePart.isMainBore);
completion.addMetadata(wellBorePart.metaData, QString::number(transmissibility));
completionData.push_back(completion);
}
}
@ -189,52 +169,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 +188,7 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneImportedLate
WellBorePartForTransCalc wellBorePart = WellBorePartForTransCalc(cell.internalCellLengths,
diameter / 2,
skinFactor,
isMainBore,
completionMetaData);
wellBorePartsInCells[cell.cellIndex].push_back(wellBorePart);
}
@ -256,9 +198,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 +224,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

@ -54,6 +54,7 @@
#include <QFileDialog>
#include <QMessageBox>
#include "RicFishbonesTransmissibilityCalculationFeatureImp.h"
#include "RigActiveCellInfo.h"
CAF_CMD_SOURCE_INIT(RicWellPathExportCompletionDataFeature, "RicWellPathExportCompletionDataFeature");
@ -138,7 +139,8 @@ std::vector<RimWellPath*> RicWellPathExportCompletionDataFeature::selectedWellPa
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellPathExportCompletionDataFeature::exportCompletions(const std::vector<RimWellPath*>& wellPaths, const RicExportCompletionDataSettingsUi& exportSettings)
void RicWellPathExportCompletionDataFeature::exportCompletions(const std::vector<RimWellPath*>& wellPaths,
const RicExportCompletionDataSettingsUi& exportSettings)
{
if (exportSettings.caseToApply() == nullptr)
@ -167,12 +169,7 @@ void RicWellPathExportCompletionDataFeature::exportCompletions(const std::vector
bool unitSystemMismatch = false;
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;
@ -184,9 +181,8 @@ void RicWellPathExportCompletionDataFeature::exportCompletions(const std::vector
return;
}
}
std::map<IJKCellIndex, std::vector<RigCompletionData> > completionData;
std::map<IJKCellIndex, std::vector<RigCompletionData> > completionsPerEclipseCell;
for (auto wellPath : usedWellPaths)
{
@ -195,26 +191,23 @@ void RicWellPathExportCompletionDataFeature::exportCompletions(const std::vector
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);
}
}
// 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(RigCompletionData::combine(data.second));
completions.push_back(combineEclipseCellCompletions(data.second, exportSettings));
}
const QString eclipseCaseName = exportSettings.caseToApply->caseUserDescription();
@ -259,11 +252,102 @@ void RicWellPathExportCompletionDataFeature::exportCompletions(const std::vector
}
}
//==================================================================================================
///
//==================================================================================================
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();
resultCompletion.m_metadata.reserve(resultCompletion.m_metadata.size() + completion.m_metadata.size());
resultCompletion.m_metadata.insert(resultCompletion.m_metadata.end(), completion.m_metadata.begin(), completion.m_metadata.end());
}
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))
@ -280,6 +364,8 @@ void RicWellPathExportCompletionDataFeature::printCompletionsToFile(const QStrin
// Print completion data
generateCompdatTable(formatter, completions);
if (includeWpimult)
{
generateWpimultTable(formatter, completions);
@ -418,7 +504,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())
{
@ -428,13 +518,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);
completion.addMetadata("Perforation", QString("StartMD: %1 - EndMD: %2").arg(interval->startMD()).arg(interval->endMD() + QString(" : ") + QString::number(transmissibility)));
completionData.push_back(completion);
}
}
@ -668,7 +773,7 @@ double RicWellPathExportCompletionDataFeature::calculateTransmissibility(RimEcli
double wellRadius,
size_t cellIndex,
size_t volumeScaleConstant,
QString directionForVolumeScaling)
CellDirection directionForVolumeScaling)
{
RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData();
@ -697,9 +802,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);
@ -708,3 +813,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

@ -136,8 +136,23 @@ 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 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);

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

@ -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

@ -109,6 +109,14 @@ std::vector<const RimFishboneWellPath*> RimFishboneWellPathCollection::wellPaths
return paths;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishboneWellPathCollection::setUnitSystemSpecificDefaults()
{
m_pipeProperties->setUnitSystemSpecificDefaults();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -23,6 +23,8 @@
#include "RimFishboneWellPath.h"
#include "RimFishbonesPipeProperties.h"
#include "RiaEclipseUnitTools.h"
#include "cafPdmObject.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmChildField.h"
@ -45,9 +47,11 @@ public:
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;

View File

@ -84,6 +84,39 @@ void RimFishbonesCollection::fieldChangedByUi(const caf::PdmFieldHandle* changed
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);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -92,6 +125,7 @@ void RimFishbonesCollection::appendFishbonesSubs(RimFishbonesMultipleSubs* subs)
subs->fishbonesColor = nextFishbonesColor();
fishbonesSubs.push_back(subs);
subs->setUnitSystemSpecificDefaults();
subs->recomputeLateralLocations();
}
@ -157,3 +191,83 @@ void RimFishbonesCollection::recalculateStartMD()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
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;

View File

@ -174,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;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -239,6 +316,37 @@ void RimFishbonesMultipleSubs::recomputeLateralLocations()
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();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -352,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,11 +81,11 @@ 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;
@ -92,6 +94,8 @@ public:
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>
@ -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,10 +19,13 @@
#include "RimWellPathCompletions.h"
#include "RimFishbonesCollection.h"
#include "RimFishboneWellPathCollection.h"
#include "RimPerforationCollection.h"
#include "cvfAssert.h"
#include "cafPdmUiTreeOrdering.h"
CAF_PDM_SOURCE_INIT(RimWellPathCompletions, "WellPathCompletions");
@ -80,3 +83,39 @@ QString RimWellPathCompletions::wellNameForExport() const
return m_wellNameForExport();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
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

@ -41,6 +41,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

@ -86,12 +86,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

@ -1543,7 +1543,7 @@ bool RimReservoirCellResultsStorage::isDataPresent(size_t scalarResultIndex) con
return false;
}
const std::vector< std::vector<double> > data = m_cellResults->cellScalarResults(scalarResultIndex);
const std::vector< std::vector<double> >& data = m_cellResults->cellScalarResults(scalarResultIndex);
for (size_t tsIdx = 0; tsIdx < data.size(); ++tsIdx)
{
@ -1575,25 +1575,7 @@ double RimReservoirCellResultsStorage::darchysValue()
if (rimCase && rimCase->eclipseCaseData())
{
RigEclipseCaseData::UnitsType unitsType = rimCase->eclipseCaseData()->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
}
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

@ -366,7 +366,11 @@ void RimWellPath::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, Q
{
uiTreeOrdering.skipRemainingChildren(true);
uiTreeOrdering.add(&m_wellLogFile);
uiTreeOrdering.add(&m_completions);
if (m_completions->hasCompletions())
{
uiTreeOrdering.add(&m_completions);
}
}
//--------------------------------------------------------------------------------------------------
@ -479,6 +483,8 @@ double RimWellPath::combinedScaleFactor() const
void RimWellPath::setUnitSystem(RiaEclipseUnitTools::UnitSystem unitSystem)
{
m_unitSystem = unitSystem;
m_completions->setUnitSystemSpecificDefaults();
}
//--------------------------------------------------------------------------------------------------

View File

@ -439,14 +439,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

@ -23,6 +23,7 @@
#include <QString>
#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(HUGE_VAL),
m_isMainBore(false),
m_readyForExport(false)
{
}
@ -130,31 +134,62 @@ void RigCompletionData::setFromFracture(double transmissibility, double skinFact
//==================================================================================================
///
//==================================================================================================
void RigCompletionData::setFromFishbone(double diameter, CellDirection direction)
{
m_completionType = FISHBONES;
m_diameter = diameter;
m_direction = direction;
}
//==================================================================================================
///
//==================================================================================================
void RigCompletionData::setFromFishbone(double transmissibility, double skinFactor)
void RigCompletionData::setTransAndWPImultBackgroundDataFromFishbone(double transmissibility,
double skinFactor,
double diameter,
CellDirection direction,
bool isMainBore)
{
m_completionType = FISHBONES;
m_transmissibility = transmissibility;
m_skinFactor = skinFactor;
m_diameter = diameter;
m_direction = direction;
m_isMainBore = isMainBore;
}
//==================================================================================================
///
//==================================================================================================
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_direction = celldirection;
m_completionType = completionType;
m_skinFactor = skinFactor;
m_diameter = wellDiameter;
m_readyForExport = true;
}
//==================================================================================================

View File

@ -107,9 +107,26 @@ public:
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,
bool isMainBore);
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);
@ -119,29 +136,36 @@ 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; }
double wpimult() const { return m_wpimult; }
CompletionType completionType() const { return m_completionType; }
bool isMainBore() const { return m_isMainBore; }
bool readyForExport() const { return m_readyForExport; }
std::vector<RigCompletionMetaData> m_metadata; //TODO: Is this OK?
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
double m_wpimult;
CompletionType m_completionType;

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;
}
//--------------------------------------------------------------------------------------------------

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,8 +86,8 @@ public:
void computeActiveCellBoundingBoxes();
UnitsType unitsType() const { return m_unitsType; }
void setUnitsType(UnitsType unitsType) { m_unitsType = unitsType; }
RiaEclipseUnitTools::UnitSystem unitsType() const { return m_unitsType; }
void setUnitsType(RiaEclipseUnitTools::UnitSystem unitsType) { m_unitsType = unitsType; }
private:
void computeActiveCellIJKBBox();
@ -115,5 +109,5 @@ private:
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::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);