Merge branch 'dev' into pre-proto

This commit is contained in:
Magne Sjaastad 2017-06-08 14:09:03 +02:00
commit dd912b4f97
80 changed files with 913 additions and 521 deletions

View File

@ -987,15 +987,15 @@ bool RiaApplication::openEclipseCase(const QString& caseName, const QString& cas
{
if (rimResultReservoir->eclipseCaseData()->unitsType() == RigEclipseCaseData::UNITS_METRIC)
{
project()->activeOilField()->fractureDefinitionCollection->defaultUnitsForFracTemplates = RimDefines::UNITS_METRIC;
project()->activeOilField()->fractureDefinitionCollection->defaultUnitsForFracTemplates = RimUnitSystem::UNITS_METRIC;
}
else if (rimResultReservoir->eclipseCaseData()->unitsType() == RigEclipseCaseData::UNITS_FIELD)
{
project()->activeOilField()->fractureDefinitionCollection->defaultUnitsForFracTemplates = RimDefines::UNITS_FIELD;
project()->activeOilField()->fractureDefinitionCollection->defaultUnitsForFracTemplates = RimUnitSystem::UNITS_FIELD;
}
else if (rimResultReservoir->eclipseCaseData()->unitsType() == RigEclipseCaseData::UNITS_LAB)
{
project()->activeOilField()->fractureDefinitionCollection->defaultUnitsForFracTemplates = RimDefines::UNITS_METRIC;
project()->activeOilField()->fractureDefinitionCollection->defaultUnitsForFracTemplates = RimUnitSystem::UNITS_METRIC;
}
}
}
@ -1504,14 +1504,14 @@ bool RiaApplication::parseArguments()
foreach (QString caseName, caseNames)
{
QString caseFileNameWithExt = caseName + ".EGRID";
if (!caf::Utils::fileExists(caseFileNameWithExt))
if (caf::Utils::fileExists(caseFileNameWithExt))
{
openEclipseCaseFromFile(caseFileNameWithExt);
}
else
{
caseFileNameWithExt = caseName + ".GRID";
if (!caf::Utils::fileExists(caseFileNameWithExt))
if (caf::Utils::fileExists(caseFileNameWithExt))
{
openEclipseCaseFromFile(caseFileNameWithExt);
}

View File

@ -124,7 +124,6 @@ list( APPEND REFERENCED_CMAKE_FILES
Commands/CrossSectionCommands/CMakeLists_files.cmake
Commands/EclipseCommands/CMakeLists_files.cmake
Commands/EclipseCommands/EclipseWell/CMakeLists_files.cmake
Commands/PerforationCommands/CMakeLists_files.cmake
Commands/FlowCommands/CMakeLists_files.cmake
Commands/IntersectionBoxCommands/CMakeLists_files.cmake
Commands/OctaveScriptCommands/CMakeLists_files.cmake

View File

@ -6,6 +6,7 @@ endif()
set (SOURCE_GROUP_HEADER_FILES
${CEE_CURRENT_LIST_DIR}RicCaseAndFileExportSettingsUi.h
${CEE_CURRENT_LIST_DIR}RicEditPerforationCollectionFeature.h
${CEE_CURRENT_LIST_DIR}RicExportCompletionDataSettingsUi.h
${CEE_CURRENT_LIST_DIR}RicExportFishbonesLateralsFeature.h
${CEE_CURRENT_LIST_DIR}RicExportFishbonesWellSegmentsFeature.h
@ -13,6 +14,8 @@ ${CEE_CURRENT_LIST_DIR}RicExportFractureCompletionsImpl.h
${CEE_CURRENT_LIST_DIR}RicExportWellSegmentsSettingsUi.h
${CEE_CURRENT_LIST_DIR}RicNewFishbonesSubsAtMeasuredDepthFeature.h
${CEE_CURRENT_LIST_DIR}RicNewFishbonesSubsFeature.h
${CEE_CURRENT_LIST_DIR}RicNewPerforationIntervalFeature.h
${CEE_CURRENT_LIST_DIR}RicNewPerforationIntervalAtMeasuredDepthFeature.h
${CEE_CURRENT_LIST_DIR}RicWellPathExportCompletionDataFeature.h
${CEE_CURRENT_LIST_DIR}RicWellPathImportCompletionsFileFeature.h
${CEE_CURRENT_LIST_DIR}RicWellPathImportPerforationIntervalsFeature.h
@ -20,6 +23,7 @@ ${CEE_CURRENT_LIST_DIR}RicWellPathImportPerforationIntervalsFeature.h
set (SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RicCaseAndFileExportSettingsUi.cpp
${CEE_CURRENT_LIST_DIR}RicEditPerforationCollectionFeature.cpp
${CEE_CURRENT_LIST_DIR}RicExportCompletionDataSettingsUi.cpp
${CEE_CURRENT_LIST_DIR}RicExportFishbonesLateralsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicExportFishbonesWellSegmentsFeature.cpp
@ -27,6 +31,8 @@ ${CEE_CURRENT_LIST_DIR}RicExportFractureCompletionsImpl.cpp
${CEE_CURRENT_LIST_DIR}RicExportWellSegmentsSettingsUi.cpp
${CEE_CURRENT_LIST_DIR}RicNewFishbonesSubsAtMeasuredDepthFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewFishbonesSubsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewPerforationIntervalFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewPerforationIntervalAtMeasuredDepthFeature.cpp
${CEE_CURRENT_LIST_DIR}RicWellPathExportCompletionDataFeature.cpp
${CEE_CURRENT_LIST_DIR}RicWellPathImportCompletionsFileFeature.cpp
${CEE_CURRENT_LIST_DIR}RicWellPathImportPerforationIntervalsFeature.cpp

View File

@ -18,6 +18,8 @@
#include "RicEditPerforationCollectionFeature.h"
#include "WellPathCommands/RicWellPathsUnitSystemSettingsImpl.h"
#include "RiuEditPerforationCollectionWidget.h"
#include "RimPerforationCollection.h"
@ -46,9 +48,13 @@ void RicEditPerforationCollectionFeature::onActionTriggered(bool isChecked)
this->disableModelChangeContribution();
RimPerforationCollection* perforationCollection = selectedPerforationCollection();
if (perforationCollection == nullptr) return;
RimWellPath* wellPath;
perforationCollection->firstAncestorOrThisOfTypeAsserted(wellPath);
if (!RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem(wellPath)) return;
RiuEditPerforationCollectionWidget dlg(nullptr, perforationCollection);
dlg.exec();

View File

@ -29,6 +29,8 @@ RicExportCompletionDataSettingsUi::RicExportCompletionDataSettingsUi()
CAF_PDM_InitField(&timeStep, "TimeStepIndex", 0, "Time Step", "", "", "");
CAF_PDM_InitField(&computeTransmissibility, "ComputeTransmissibility", true, "Compute Transmissibility", "", "", "");
CAF_PDM_InitField(&includePerforations, "IncludePerforations", true, "Include Perforations", "", "", "");
CAF_PDM_InitField(&includeFishbones, "IncludeFishbones", true, "Include Fishbones", "", "", "");
CAF_PDM_InitField(&includeFractures, "IncludeFractures", true, "Include Fractures", "", "", "");

View File

@ -33,6 +33,7 @@ public:
RicExportCompletionDataSettingsUi();
caf::PdmField<bool> computeTransmissibility;
caf::PdmField<bool> includePerforations;
caf::PdmField<bool> includeFishbones;
caf::PdmField<bool> includeFractures;

View File

@ -79,8 +79,6 @@ void RicExportFishbonesLateralsFeature::onActionTriggered(bool isChecked)
// x y TVD MD
// separate laterals using -999 on a single line
size_t fishboneSubIndex = 0;
QTextStream stream(&exportFile);
for (RimFishbonesMultipleSubs* fishbone : fishbonesCollection->fishbonesSubs())
{
@ -93,7 +91,7 @@ void RicExportFishbonesLateralsFeature::onActionTriggered(bool isChecked)
std::vector<std::pair<cvf::Vec3d, double>> coordsAndMD = fishbone->coordsAndMDForLateral(sub.subIndex, lateralIndex);
// Pad with "0" to get a total of two characters defining the sub index text
QString subIndexText = QString("%1").arg(fishboneSubIndex++, 2, 10, QChar('0'));
QString subIndexText = QString("%1").arg(sub.subIndex, 2, 10, QChar('0'));
QString lateralNameCandidate = QString("%1_%2_%3_%4").arg(wellPath->name()).arg("fishbone").arg(subIndexText).arg(lateralIndex);

View File

@ -30,6 +30,7 @@
#include "RigMainGrid.h"
#include "RigEclipseCaseData.h"
#include "RigWellPath.h"
#include "RiuMainWindow.h"
@ -185,7 +186,8 @@ void RicExportFishbonesWellSegmentsFeature::generateWelsegsTable(RifEclipseDataT
{
formatter.keyword("WELSEGS");
const WellSegmentLocation& firstLocation = locations[0];
double startMD = wellPath->fishbonesCollection()->startMD();
double startTVD = -wellPath->wellPathGeometry()->interpolatedPointAlongWellPath(startMD).z();
{
std::vector<RifEclipseOutputTableColumn> header = {
@ -199,8 +201,8 @@ void RicExportFishbonesWellSegmentsFeature::generateWelsegsTable(RifEclipseDataT
formatter.header(header);
formatter.add(wellPath->name());
formatter.add(firstLocation.trueVerticalDepth);
formatter.add(firstLocation.measuredDepth);
formatter.add(startTVD);
formatter.add(startMD);
formatter.add("1*");
formatter.add(settings.lengthAndDepth().text());
formatter.add(settings.pressureDrop().text());
@ -223,25 +225,24 @@ void RicExportFishbonesWellSegmentsFeature::generateWelsegsTable(RifEclipseDataT
}
{
WellSegmentLocation previousLocation = firstLocation;
formatter.comment("Main stem");
double depth = 0;
double length = 0;
double previousMD = startMD;
double previousTVD = startTVD;
for (size_t i = 0; i < locations.size(); ++i)
for (const WellSegmentLocation& location : locations)
{
const WellSegmentLocation& location = locations[i];
if (settings.lengthAndDepth() == RicExportWellSegmentsSettingsUi::INC)
{
depth = location.trueVerticalDepth - previousLocation.trueVerticalDepth;
length = location.fishbonesSubs->measuredDepth(location.subIndex) - previousLocation.fishbonesSubs->measuredDepth(previousLocation.subIndex);
depth = location.trueVerticalDepth - previousTVD;
length = location.fishbonesSubs->measuredDepth(location.subIndex) - previousMD;
}
else
{
depth += location.trueVerticalDepth - previousLocation.trueVerticalDepth;
length += location.fishbonesSubs->measuredDepth(location.subIndex) - previousLocation.fishbonesSubs->measuredDepth(previousLocation.subIndex);
depth += location.trueVerticalDepth - previousTVD;
length += location.fishbonesSubs->measuredDepth(location.subIndex) - previousMD;
}
formatter.comment(QString("Segment for sub %1").arg(location.subIndex));
@ -254,7 +255,8 @@ void RicExportFishbonesWellSegmentsFeature::generateWelsegsTable(RifEclipseDataT
formatter.add(-1.0); // FIXME : Rough of main stem?
formatter.rowCompleted();
previousLocation = location;
previousMD = location.measuredDepth;
previousTVD = location.trueVerticalDepth;
}
}

View File

@ -19,6 +19,7 @@
#include "RicNewFishbonesSubsAtMeasuredDepthFeature.h"
#include "RicNewFishbonesSubsFeature.h"
#include "WellPathCommands/RicWellPathsUnitSystemSettingsImpl.h"
#include "RimFishbonesCollection.h"
#include "RimFishbonesMultipleSubs.h"
@ -45,6 +46,8 @@ void RicNewFishbonesSubsAtMeasuredDepthFeature::onActionTriggered(bool isChecked
RimWellPath* wellPath = wellPathSelItem->m_wellpath;
CVF_ASSERT(wellPath);
if (!RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem(wellPath)) return;
RimFishbonesMultipleSubs* obj = new RimFishbonesMultipleSubs;
wellPath->fishbonesCollection()->appendFishbonesSubs(obj);

View File

@ -18,6 +18,8 @@
#include "RicNewFishbonesSubsFeature.h"
#include "WellPathCommands/RicWellPathsUnitSystemSettingsImpl.h"
#include "RiaApplication.h"
#include "RimProject.h"
@ -45,6 +47,10 @@ void RicNewFishbonesSubsFeature::onActionTriggered(bool isChecked)
RimFishbonesCollection* fishbonesCollection = selectedFishbonesCollection();
CVF_ASSERT(fishbonesCollection);
RimWellPath* wellPath;
fishbonesCollection->firstAncestorOrThisOfTypeAsserted(wellPath);
if (!RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem(wellPath)) return;
RimFishbonesMultipleSubs* obj = new RimFishbonesMultipleSubs;
obj->setName(QString("Fishbones Subs (%1)").arg(fishbonesCollection->fishbonesSubs.size()));
fishbonesCollection->appendFishbonesSubs(obj);

View File

@ -18,6 +18,8 @@
#include "RicNewPerforationIntervalAtMeasuredDepthFeature.h"
#include "WellPathCommands/RicWellPathsUnitSystemSettingsImpl.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimPerforationCollection.h"
#include "RimPerforationInterval.h"
@ -45,6 +47,8 @@ void RicNewPerforationIntervalAtMeasuredDepthFeature::onActionTriggered(bool isC
RimWellPath* wellPath = wellPathSelItem->m_wellpath;
CVF_ASSERT(wellPath);
if (!RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem(wellPath)) return;
RimPerforationInterval* perforationInterval = new RimPerforationInterval;
int measuredDepth = wellPathSelItem->m_measuredDepth;

View File

@ -19,6 +19,8 @@
#include "RicNewPerforationIntervalFeature.h"
#include "WellPathCommands/RicWellPathsUnitSystemSettingsImpl.h"
#include "RiuMainWindow.h"
#include "RimPerforationInterval.h"
@ -49,6 +51,10 @@ void RicNewPerforationIntervalFeature::onActionTriggered(bool isChecked)
RimPerforationCollection* perforationCollection = selectedPerforationCollection();
if (perforationCollection == nullptr) return;
RimWellPath* wellPath;
perforationCollection->firstAncestorOrThisOfTypeAsserted(wellPath);
if (!RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem(wellPath)) return;
RimPerforationInterval* perforationInterval = new RimPerforationInterval;
perforationCollection->appendPerforation(perforationInterval);

View File

@ -30,6 +30,8 @@
#include "RimFishboneWellPathCollection.h"
#include "RimPerforationInterval.h"
#include "RimPerforationCollection.h"
#include "RimReservoirCellResultsStorage.h"
#include "RicExportCompletionDataSettingsUi.h"
#include "RiuMainWindow.h"
@ -39,6 +41,8 @@
#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
#include "RigWellPath.h"
#include "RigResultAccessorFactory.h"
#include "RigTransmissibilityEquations.h"
#include "cafSelectionManager.h"
#include "cafPdmUiPropertyViewDialog.h"
@ -149,6 +153,28 @@ void RicWellPathExportCompletionDataFeature::exportCompletions(const std::vector
return;
}
{
bool unitSystemMismatch = false;
for (const RimWellPath* wellPath : wellPaths)
{
if (wellPath->unitSystem() == RimUnitSystem::UNITS_FIELD && exportSettings.caseToApply->eclipseCaseData()->unitsType() != RigEclipseCaseData::UNITS_FIELD)
{
unitSystemMismatch = true;
break;
}
else if (wellPath->unitSystem() == RimUnitSystem::UNITS_METRIC && exportSettings.caseToApply->eclipseCaseData()->unitsType() != RigEclipseCaseData::UNITS_METRIC)
{
unitSystemMismatch = true;
break;
}
}
if (unitSystemMismatch)
{
RiaLogging::error("Well path unit systems must match unit system of chosen eclipse case.");
return;
}
}
QTextStream stream(&exportFile);
RifEclipseDataTableFormatter formatter(stream);
@ -194,6 +220,8 @@ void RicWellPathExportCompletionDataFeature::exportCompletions(const std::vector
{
generateWpimultTable(formatter, completions);
}
RiaLogging::info(QString("Successfully exported completion data to %1").arg(exportSettings.fileName()));
}
//--------------------------------------------------------------------------------------------------
@ -336,8 +364,20 @@ std::vector<RigCompletionData> RicWellPathExportCompletionDataFeature::generateF
RigCompletionData completion(wellPath->name(), 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;
CellDirection direction = wellPathCellDirectionToCellDirection(intersection.direction);
completion.setFromFishbone(diameter, direction);
if (settings.computeTransmissibility())
{
double transmissibility = calculateTransmissibility(settings.caseToApply,
wellPath,
intersection.lengthsInCell,
location.fishbonesSubs->skinFactor(),
diameter / 2,
intersection.cellIndex);
completion.setFromFishbone(transmissibility, location.fishbonesSubs->skinFactor());
}
else {
CellDirection direction = calculateDirectionInCell(settings.caseToApply, intersection.cellIndex, intersection.lengthsInCell);
completion.setFromFishbone(diameter, direction);
}
completionData.push_back(completion);
}
}
@ -349,22 +389,39 @@ std::vector<RigCompletionData> RicWellPathExportCompletionDataFeature::generateF
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RigCompletionData> RicWellPathExportCompletionDataFeature::generateFishbonesWellPathCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi & settings)
std::vector<RigCompletionData> RicWellPathExportCompletionDataFeature::generateFishbonesWellPathCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings)
{
std::vector<RigCompletionData> completionData;
std::vector<size_t> wellPathCells = 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 (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->name(), IJKCellIndex(i, j, k));
completion.addMetadata(fishbonesPath->name(), "");
CellDirection direction = wellPathCellDirectionToCellDirection(cell.direction);
completion.setFromFishbone(diameter, direction);
if (settings.computeTransmissibility())
{
double skinFactor = wellPath->fishbonesCollection()->wellPathCollection()->skinFactor();
double transmissibility = calculateTransmissibility(settings.caseToApply(),
wellPath,
cell.internalCellLengths,
skinFactor,
diameter / 2,
cell.cellIndex);
completion.setFromFishbone(transmissibility, skinFactor);
}
else {
CellDirection direction = calculateDirectionInCell(settings.caseToApply, cell.cellIndex, cell.internalCellLengths);
completion.setFromFishbone(diameter, direction);
}
completionData.push_back(completion);
}
}
@ -392,7 +449,7 @@ std::vector<RigCompletionData> RicWellPathExportCompletionDataFeature::generateP
RigCompletionData completion(wellPath->name(), IJKCellIndex(i, j, k));
completion.addMetadata("Perforation", QString("StartMD: %1 - EndMD: %2").arg(interval->startMD()).arg(interval->endMD()));
double diameter = interval->diameter();
CellDirection direction = wellPathCellDirectionToCellDirection(cell.direction);
CellDirection direction = calculateDirectionInCell(settings.caseToApply, cell.cellIndex, cell.internalCellLengths);
completion.setFromPerforation(diameter, direction);
completionData.push_back(completion);
}
@ -526,7 +583,7 @@ void RicWellPathExportCompletionDataFeature::calculateLateralIntersections(const
depth += intersection->endPoint.z() - startPoint.z();
WellSegmentLateralIntersection lateralIntersection(++(*segmentNum), attachedSegmentNumber, intersection->cellIndex, length, depth);
lateralIntersection.direction = intersection->direction;
lateralIntersection.lengthsInCell = intersection->internalCellLengths;
lateral.intersections.push_back(lateralIntersection);
length = 0;
@ -588,20 +645,68 @@ void RicWellPathExportCompletionDataFeature::appendCompletionData(std::map<IJKCe
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
CellDirection RicWellPathExportCompletionDataFeature::wellPathCellDirectionToCellDirection(WellPathCellDirection direction)
CellDirection RicWellPathExportCompletionDataFeature::calculateDirectionInCell(RimEclipseCase* eclipseCase, size_t cellIndex, const cvf::Vec3d& lengthsInCell)
{
switch (direction)
RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData();
eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RimDefines::STATIC_NATIVE, "DX");
cvf::ref<RigResultAccessor> dxAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "DX");
eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RimDefines::STATIC_NATIVE, "DY");
cvf::ref<RigResultAccessor> dyAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "DY");
eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RimDefines::STATIC_NATIVE, "DZ");
cvf::ref<RigResultAccessor> dzAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "DZ");
double xLengthFraction = abs(lengthsInCell.x() / dxAccessObject->cellScalarGlobIdx(cellIndex));
double yLengthFraction = abs(lengthsInCell.y() / dyAccessObject->cellScalarGlobIdx(cellIndex));
double zLengthFraction = abs(lengthsInCell.z() / dzAccessObject->cellScalarGlobIdx(cellIndex));
if (xLengthFraction > yLengthFraction && xLengthFraction > zLengthFraction)
{
case POS_I:
case NEG_I:
return CellDirection::DIR_I;
case POS_J:
case NEG_J:
}
else if (yLengthFraction > xLengthFraction && yLengthFraction > zLengthFraction)
{
return CellDirection::DIR_J;
case POS_K:
case NEG_K:
}
else
{
return CellDirection::DIR_K;
default:
return CellDirection::DIR_UNDEF;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicWellPathExportCompletionDataFeature::calculateTransmissibility(RimEclipseCase* eclipseCase, const RimWellPath* wellPath, const cvf::Vec3d& internalCellLengths, double skinFactor, double wellRadius, size_t cellIndex)
{
RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData();
eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RimDefines::STATIC_NATIVE, "DX");
cvf::ref<RigResultAccessor> dxAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "DX");
eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RimDefines::STATIC_NATIVE, "DY");
cvf::ref<RigResultAccessor> dyAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "DY");
eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RimDefines::STATIC_NATIVE, "DZ");
cvf::ref<RigResultAccessor> dzAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "DZ");
eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RimDefines::STATIC_NATIVE, "PERMX");
cvf::ref<RigResultAccessor> permxAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "PERMX");
eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RimDefines::STATIC_NATIVE, "PERMY");
cvf::ref<RigResultAccessor> permyAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "PERMY");
eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RimDefines::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);
double darcy = RimUnitSystem::darcysConstant(wellPath->unitSystem());
double transx = RigTransmissibilityEquations::wellBoreTransmissibilityComponent(internalCellLengths.x(), permy, permz, dy, dz, wellRadius, skinFactor, darcy);
double transy = RigTransmissibilityEquations::wellBoreTransmissibilityComponent(internalCellLengths.y(), permx, permz, dx, dz, wellRadius, skinFactor, darcy);
double transz = RigTransmissibilityEquations::wellBoreTransmissibilityComponent(internalCellLengths.z(), permy, permx, dy, dx, wellRadius, skinFactor, darcy);
return RigTransmissibilityEquations::totalConnectionFactor(transx, transy, transz);
}

View File

@ -48,7 +48,6 @@ struct WellSegmentLateralIntersection {
cellIndex(cellIndex),
length(length),
depth(depth),
direction(POS_I),
mainBoreCell(false)
{}
@ -58,7 +57,7 @@ struct WellSegmentLateralIntersection {
bool mainBoreCell;
double length;
double depth;
WellPathCellDirection direction;
cvf::Vec3d lengthsInCell;
};
//==================================================================================================
@ -151,5 +150,7 @@ private:
static void appendCompletionData(std::map<IJKCellIndex, RigCompletionData>* completionData, const std::vector<RigCompletionData>& data);
static CellDirection wellPathCellDirectionToCellDirection(WellPathCellDirection direction);
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);
};

View File

@ -1,27 +0,0 @@
# Use this workaround until we're on 2.8.3 on all platforms and can use CMAKE_CURRENT_LIST_DIR directly
if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
set(CEE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}/)
endif()
set (SOURCE_GROUP_HEADER_FILES
${CEE_CURRENT_LIST_DIR}RicEditPerforationCollectionFeature.h
${CEE_CURRENT_LIST_DIR}RicNewPerforationIntervalFeature.h
${CEE_CURRENT_LIST_DIR}RicNewPerforationIntervalAtMeasuredDepthFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RicEditPerforationCollectionFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewPerforationIntervalFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewPerforationIntervalAtMeasuredDepthFeature.cpp
)
list(APPEND CODE_HEADER_FILES
${SOURCE_GROUP_HEADER_FILES}
)
list(APPEND CODE_SOURCE_FILES
${SOURCE_GROUP_SOURCE_FILES}
)
source_group( "CommandFeature\\Perforations" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )

View File

@ -65,7 +65,7 @@ void RicConvertAllFractureTemplatesToFieldFeature::onActionTriggered(bool isChec
for (auto ellipseFracTemplate : ellipseFracTemplates)
{
if (ellipseFracTemplate->fractureTemplateUnit == RimDefines::UNITS_METRIC)
if (ellipseFracTemplate->fractureTemplateUnit == RimUnitSystem::UNITS_METRIC)
{
ellipseFracTemplate->changeUnits();
}

View File

@ -64,7 +64,7 @@ void RicConvertAllFractureTemplatesToMetricFeature::onActionTriggered(bool isChe
for (auto ellipseFracTemplate : ellipseFracTemplates)
{
if (ellipseFracTemplate->fractureTemplateUnit == RimDefines::UNITS_FIELD)
if (ellipseFracTemplate->fractureTemplateUnit == RimUnitSystem::UNITS_FIELD)
{
ellipseFracTemplate->changeUnits();
}

View File

@ -81,11 +81,11 @@ void RicConvertFractureTemplateUnitFeature::setupActionLook(QAction* actionToSet
objHandle->firstAncestorOrThisOfType(ellipseFractureTemplate);
QString text = "Convert Values to ";
if (ellipseFractureTemplate->fractureTemplateUnit == RimDefines::UNITS_METRIC)
if (ellipseFractureTemplate->fractureTemplateUnit == RimUnitSystem::UNITS_METRIC)
{
text += "Field";
}
else if (ellipseFractureTemplate->fractureTemplateUnit == RimDefines::UNITS_FIELD)
else if (ellipseFractureTemplate->fractureTemplateUnit == RimUnitSystem::UNITS_FIELD)
{
text += "Metric";
}

View File

@ -91,8 +91,8 @@ void RicNewSimWellFractureAtPosFeature::onActionTriggered(bool isChecked)
RimEclipseResultCase* eclipseCase = nullptr;
objHandle->firstAncestorOrThisOfType(eclipseCase);
RigEclipseCaseData::UnitsType caseUnit = eclipseCase->eclipseCaseData()->unitsType();
if (caseUnit == RigEclipseCaseData::UNITS_METRIC) fracture->fractureUnit = RimDefines::UNITS_METRIC;
else if (caseUnit == RigEclipseCaseData::UNITS_FIELD) fracture->fractureUnit = RimDefines::UNITS_FIELD;
if (caseUnit == RigEclipseCaseData::UNITS_METRIC) fracture->fractureUnit = RimUnitSystem::UNITS_METRIC;
else if (caseUnit == RigEclipseCaseData::UNITS_FIELD) fracture->fractureUnit = RimUnitSystem::UNITS_FIELD;
if (oilfield->fractureDefinitionCollection->fractureDefinitions.size() > 0)
{

View File

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

View File

@ -8,6 +8,8 @@ set (SOURCE_GROUP_HEADER_FILES
${CEE_CURRENT_LIST_DIR}RicWellPathDeleteFeature.h
${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.h
${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.h
${CEE_CURRENT_LIST_DIR}RicWellPathsUnitSystemSettingsImpl.h
${CEE_CURRENT_LIST_DIR}RicWellPathsUnitSystemSettingsUi.h
${CEE_CURRENT_LIST_DIR}RicWellPathViewerEventHandler.h
)
@ -15,6 +17,8 @@ set (SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RicWellPathDeleteFeature.cpp
${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.cpp
${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.cpp
${CEE_CURRENT_LIST_DIR}RicWellPathsUnitSystemSettingsImpl.cpp
${CEE_CURRENT_LIST_DIR}RicWellPathsUnitSystemSettingsUi.cpp
${CEE_CURRENT_LIST_DIR}RicWellPathViewerEventHandler.cpp
)

View File

@ -0,0 +1,45 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017- Statoil ASA
//
// ResInsight 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.
//
// ResInsight 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicWellPathsUnitSystemSettingsImpl.h"
#include "RicWellPathsUnitSystemSettingsUi.h"
#include "RiuMainWindow.h"
#include "cafPdmUiPropertyViewDialog.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem(RimWellPath * wellPath)
{
if (wellPath->unitSystem() != RimUnitSystem::UNITS_UNKNOWN)
{
return true;
}
RicWellPathsUnitSystemSettingsUi settings;
caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &settings, "Select Unit System for Well Path", "");
if (propertyDialog.exec() == QDialog::Accepted)
{
wellPath->setUnitSystem(settings.unitSystem());
return true;
}
return false;
}

View File

@ -0,0 +1,32 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017- Statoil ASA
//
// ResInsight 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.
//
// ResInsight 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimUnitSystem.h"
#include "RimWellPath.h"
//==================================================================================================
///
///
//==================================================================================================
class RicWellPathsUnitSystemSettingsImpl
{
public:
static bool ensureHasUnitSystem(RimWellPath* wellPath);
};

View File

@ -0,0 +1,45 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017- Statoil ASA
//
// ResInsight 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.
//
// ResInsight 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicWellPathsUnitSystemSettingsUi.h"
CAF_PDM_SOURCE_INIT(RicWellPathsUnitSystemSettingsUi, "RicWellPathsUnitSystemSettingsUi");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicWellPathsUnitSystemSettingsUi::RicWellPathsUnitSystemSettingsUi()
{
CAF_PDM_InitObject("RimWellPathsUnitSystemSettings", "", "", "");
CAF_PDM_InitFieldNoDefault(&unitSystem, "UnitSystem", "Unit System", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RicWellPathsUnitSystemSettingsUi::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
{
QList<caf::PdmOptionItemInfo> options;
if (fieldNeedingOptions == &unitSystem)
{
options.push_back(caf::PdmOptionItemInfo(RimUnitSystem::UnitSystemType::uiText(RimUnitSystem::UNITS_METRIC), RimUnitSystem::UNITS_METRIC));
options.push_back(caf::PdmOptionItemInfo(RimUnitSystem::UnitSystemType::uiText(RimUnitSystem::UNITS_FIELD), RimUnitSystem::UNITS_FIELD));
}
return options;
}

View File

@ -0,0 +1,41 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017- Statoil ASA
//
// ResInsight 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.
//
// ResInsight 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimUnitSystem.h"
#include "cafPdmObject.h"
#include "cafPdmField.h"
//==================================================================================================
///
///
//==================================================================================================
class RicWellPathsUnitSystemSettingsUi : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RicWellPathsUnitSystemSettingsUi();
caf::PdmField<RimUnitSystem::UnitSystemType> unitSystem;
protected:
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
};

View File

@ -14,6 +14,7 @@ ${CEE_CURRENT_LIST_DIR}RimEclipsePropertyFilterCollection.h
${CEE_CURRENT_LIST_DIR}RimCellRangeFilter.h
${CEE_CURRENT_LIST_DIR}RimCellRangeFilterCollection.h
${CEE_CURRENT_LIST_DIR}RimDefines.h
${CEE_CURRENT_LIST_DIR}RimUnitSystem.h
${CEE_CURRENT_LIST_DIR}RimLegendConfig.h
${CEE_CURRENT_LIST_DIR}RimOilField.h
${CEE_CURRENT_LIST_DIR}RimProject.h
@ -104,6 +105,7 @@ ${CEE_CURRENT_LIST_DIR}RimEclipsePropertyFilterCollection.cpp
${CEE_CURRENT_LIST_DIR}RimCellRangeFilter.cpp
${CEE_CURRENT_LIST_DIR}RimCellRangeFilterCollection.cpp
${CEE_CURRENT_LIST_DIR}RimDefines.cpp
${CEE_CURRENT_LIST_DIR}RimUnitSystem.cpp
${CEE_CURRENT_LIST_DIR}RimLegendConfig.cpp
${CEE_CURRENT_LIST_DIR}RimOilField.cpp
${CEE_CURRENT_LIST_DIR}RimProject.cpp

View File

@ -25,7 +25,7 @@
#include "RigFractureGrid.h"
#include "RigTesselatorTools.h"
#include "RimDefines.h"
#include "RimUnitSystem.h"
#include "RimFracture.h"
#include "RimFractureTemplate.h"
#include "RimProject.h"
@ -104,7 +104,7 @@ void RimEllipseFractureTemplate::fieldChangedByUi(const caf::PdmFieldHandle* cha
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEllipseFractureTemplate::fractureGeometry(std::vector<cvf::Vec3f>* nodeCoords, std::vector<cvf::uint>* triangleIndices, RimDefines::UnitSystem fractureUnit)
void RimEllipseFractureTemplate::fractureGeometry(std::vector<cvf::Vec3f>* nodeCoords, std::vector<cvf::uint>* triangleIndices, RimUnitSystem::UnitSystem fractureUnit)
{
RigEllipsisTesselator tesselator(20);
@ -117,17 +117,17 @@ void RimEllipseFractureTemplate::fractureGeometry(std::vector<cvf::Vec3f>* nodeC
b = height / 2.0f;
}
else if (fractureTemplateUnit() == RimDefines::UNITS_METRIC && fractureUnit == RimDefines::UNITS_FIELD)
else if (fractureTemplateUnit() == RimUnitSystem::UNITS_METRIC && fractureUnit == RimUnitSystem::UNITS_FIELD)
{
RiaLogging::info(QString("Converting fracture template geometry from metric to field"));
a = RimDefines::meterToFeet(halfLength);
b = RimDefines::meterToFeet(height / 2.0f);
a = RimUnitSystem::meterToFeet(halfLength);
b = RimUnitSystem::meterToFeet(height / 2.0f);
}
else if (fractureTemplateUnit() == RimDefines::UNITS_FIELD && fractureUnit == RimDefines::UNITS_METRIC)
else if (fractureTemplateUnit() == RimUnitSystem::UNITS_FIELD && fractureUnit == RimUnitSystem::UNITS_METRIC)
{
RiaLogging::info(QString("Converting fracture template geometry from field to metric"));
a = RimDefines::feetToMeter(halfLength);
b = RimDefines::feetToMeter(height / 2.0f);
a = RimUnitSystem::feetToMeter(halfLength);
b = RimUnitSystem::feetToMeter(height / 2.0f);
}
else
{
@ -143,7 +143,7 @@ void RimEllipseFractureTemplate::fractureGeometry(std::vector<cvf::Vec3f>* nodeC
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<cvf::Vec3f> RimEllipseFractureTemplate::fracturePolygon(RimDefines::UnitSystem fractureUnit)
std::vector<cvf::Vec3f> RimEllipseFractureTemplate::fracturePolygon(RimUnitSystem::UnitSystem fractureUnit)
{
std::vector<cvf::Vec3f> polygon;
@ -165,23 +165,23 @@ std::vector<cvf::Vec3f> RimEllipseFractureTemplate::fracturePolygon(RimDefines::
//--------------------------------------------------------------------------------------------------
void RimEllipseFractureTemplate::changeUnits()
{
if (fractureTemplateUnit == RimDefines::UNITS_METRIC)
if (fractureTemplateUnit == RimUnitSystem::UNITS_METRIC)
{
halfLength = RimDefines::meterToFeet(halfLength);
height = RimDefines::meterToFeet(height);
width = RimDefines::meterToInch(width);
wellDiameter = RimDefines::meterToInch(wellDiameter);
perforationLength = RimDefines::meterToFeet(perforationLength);
fractureTemplateUnit = RimDefines::UNITS_FIELD;
halfLength = RimUnitSystem::meterToFeet(halfLength);
height = RimUnitSystem::meterToFeet(height);
width = RimUnitSystem::meterToInch(width);
wellDiameter = RimUnitSystem::meterToInch(wellDiameter);
perforationLength = RimUnitSystem::meterToFeet(perforationLength);
fractureTemplateUnit = RimUnitSystem::UNITS_FIELD;
}
else if (fractureTemplateUnit == RimDefines::UNITS_FIELD)
else if (fractureTemplateUnit == RimUnitSystem::UNITS_FIELD)
{
halfLength = RimDefines::feetToMeter(halfLength);
height = RimDefines::feetToMeter(height);
width = RimDefines::inchToMeter(width);
wellDiameter = RimDefines::inchToMeter(wellDiameter);
perforationLength = RimDefines::feetToMeter(perforationLength);
fractureTemplateUnit = RimDefines::UNITS_METRIC;
halfLength = RimUnitSystem::feetToMeter(halfLength);
height = RimUnitSystem::feetToMeter(height);
width = RimUnitSystem::inchToMeter(width);
wellDiameter = RimUnitSystem::inchToMeter(wellDiameter);
perforationLength = RimUnitSystem::feetToMeter(perforationLength);
fractureTemplateUnit = RimUnitSystem::UNITS_METRIC;
}
this->updateConnectedEditors();
@ -224,15 +224,15 @@ void RimEllipseFractureTemplate::setupFractureGridCells()
cellPolygon.push_back(cvf::Vec3d(X1, Y2, 0.0));
double cond = cvf::UNDEFINED_DOUBLE;
if (fractureTemplateUnit == RimDefines::UNITS_METRIC)
if (fractureTemplateUnit == RimUnitSystem::UNITS_METRIC)
{
//Conductivity should be md-m, width is in m
cond = permeability * width;
}
else if(fractureTemplateUnit == RimDefines::UNITS_FIELD)
else if(fractureTemplateUnit == RimUnitSystem::UNITS_FIELD)
{
//Conductivity should be md-ft, but width is in inches
cond = permeability * RimDefines::inchToFeet(width);
cond = permeability * RimUnitSystem::inchToFeet(width);
}
std::vector<cvf::Vec3f> ellipseFracPolygon = fracturePolygon(fractureTemplateUnit());
@ -294,14 +294,14 @@ void RimEllipseFractureTemplate::defineUiOrdering(QString uiConfigName, caf::Pdm
{
RimFractureTemplate::defineUiOrdering(uiConfigName, uiOrdering);
if (fractureTemplateUnit == RimDefines::UNITS_METRIC)
if (fractureTemplateUnit == RimUnitSystem::UNITS_METRIC)
{
halfLength.uiCapability()->setUiName("Halflenght X<sub>f</sub> [m]");
height.uiCapability()->setUiName("Height [m]");
width.uiCapability()->setUiName("Width [m]");
wellDiameter.uiCapability()->setUiName("Well Diameter [m]");
}
else if (fractureTemplateUnit == RimDefines::UNITS_FIELD)
else if (fractureTemplateUnit == RimUnitSystem::UNITS_FIELD)
{
halfLength.uiCapability()->setUiName("Halflenght X<sub>f</sub> [Ft]");
height.uiCapability()->setUiName("Height [Ft]");

View File

@ -54,8 +54,8 @@ public:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
void fractureGeometry(std::vector<cvf::Vec3f>* nodeCoords, std::vector<cvf::uint>* polygonIndices, RimDefines::UnitSystem fractureTemplateUnit);
std::vector<cvf::Vec3f> fracturePolygon(RimDefines::UnitSystem fractureTemplateUnit);
void fractureGeometry(std::vector<cvf::Vec3f>* nodeCoords, std::vector<cvf::uint>* polygonIndices, RimUnitSystem::UnitSystem fractureTemplateUnit);
std::vector<cvf::Vec3f> fracturePolygon(RimUnitSystem::UnitSystem fractureTemplateUnit);
void changeUnits();
const RigFractureGrid* fractureGrid() const;

View File

@ -36,7 +36,7 @@ RimFishboneWellPath::RimFishboneWellPath()
m_coordinates.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_measuredDepths, "MeasuredDepth", "MeasuredDepth", "", "", "");
m_measuredDepths.uiCapability()->setUiHidden(true);
m_name.uiCapability()->setUiHidden(true);
userDescriptionField()->uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_displayCoordinates, "DisplayCoordinates", "Coordinates", "", "", "");
m_displayCoordinates.registerGetMethod(this, &RimFishboneWellPath::displayCoordinates);

View File

@ -40,8 +40,8 @@ RimFishboneWellPathCollection::RimFishboneWellPathCollection()
{
CAF_PDM_InitObject("WellPathCompletions", ":/FishBoneGroupFromFile16x16.png", "", "");
m_name.uiCapability()->setUiHidden(true);
m_name = "Well Paths";
nameField()->uiCapability()->setUiHidden(true);
this->setName("Well Paths");
CAF_PDM_InitFieldNoDefault(&m_wellPaths, "WellPaths", "Well Paths", "", "", "");
m_wellPaths.uiCapability()->setUiHidden(true);

View File

@ -46,6 +46,7 @@ public:
std::vector<const RimFishboneWellPath*> wellPaths() const;
double holeDiameter() const { return m_pipeProperties->holeDiameter(); }
double skinFactor() const { return m_pipeProperties->skinFactor(); }
protected:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;

View File

@ -29,6 +29,7 @@
#include <QColor>
#include <algorithm>
CAF_PDM_SOURCE_INIT(RimFishbonesCollection, "FishbonesCollection");
@ -39,8 +40,8 @@ RimFishbonesCollection::RimFishbonesCollection()
{
CAF_PDM_InitObject("Fishbones", ":/FishBones16x16.png", "", "");
m_name.uiCapability()->setUiHidden(true);
m_name = "Fishbones";
nameField()->uiCapability()->setUiHidden(true);
this->setName("Fishbones");
CAF_PDM_InitFieldNoDefault(&fishbonesSubs, "FishbonesSubs", "fishbonesSubs", "", "", "");
@ -49,6 +50,10 @@ RimFishbonesCollection::RimFishbonesCollection()
CAF_PDM_InitFieldNoDefault(&m_wellPathCollection, "WellPathCollection", "Well Paths", "", "", "");
m_wellPathCollection = new RimFishboneWellPathCollection;
m_wellPathCollection.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&m_startMD, "StartMD", HUGE_VAL, "Start MD", "", "", "");
CAF_PDM_InitField(&m_mainBoreDiameter, "MainBoreDiameter", 0.0, "Main Bore Diameter", "", "", "");
CAF_PDM_InitField(&m_linerDiameter, "LinerDiameter", 0.0, "Liner Diameter", "", "", "");
}
//--------------------------------------------------------------------------------------------------
@ -78,6 +83,8 @@ void RimFishbonesCollection::appendFishbonesSubs(RimFishbonesMultipleSubs* subs)
{
subs->fishbonesColor = nextFishbonesColor();
fishbonesSubs.push_back(subs);
recalculateStartMD();
}
//--------------------------------------------------------------------------------------------------
@ -113,3 +120,24 @@ cvf::Color3f RimFishbonesCollection::nextFishbonesColor() const
return cvf::Color3f::fromByteColor(qFishbonesColor.red(), qFishbonesColor.green(), qFishbonesColor.blue());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishbonesCollection::recalculateStartMD()
{
double minStartMD = HUGE_VAL;
for (const RimFishbonesMultipleSubs* sub : fishbonesSubs())
{
for (auto& index : sub->installedLateralIndices())
{
minStartMD = std::min(minStartMD, sub->measuredDepth(index.subIndex) - 13.0);
}
}
if (minStartMD < m_startMD())
{
m_startMD = minStartMD;
}
}

View File

@ -46,11 +46,19 @@ public:
caf::PdmChildArrayField<RimFishbonesMultipleSubs*> fishbonesSubs;
void recalculateStartMD();
double startMD() const { return m_startMD(); }
protected:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
private:
cvf::Color3f nextFishbonesColor() const;
private:
caf::PdmChildField<RimFishboneWellPathCollection*> m_wellPathCollection;
caf::PdmField<double> m_startMD;
caf::PdmField<double> m_mainBoreDiameter;
caf::PdmField<double> m_linerDiameter;
};

View File

@ -22,6 +22,7 @@
#include "RigWellPath.h"
#include "RimProject.h"
#include "RimWellPath.h"
#include "RimFishbonesCollection.h"
#include "cafPdmUiListEditor.h"
@ -99,7 +100,7 @@ RimFishbonesMultipleSubs::RimFishbonesMultipleSubs()
m_pipeProperties = new RimFishbonesPipeProperties;
m_name.uiCapability()->setUiReadOnly(true);
nameField()->uiCapability()->setUiReadOnly(true);
m_rigFishbonesGeometry = std::unique_ptr<RigFisbonesGeometry>(new RigFisbonesGeometry(this));
@ -334,6 +335,10 @@ void RimFishbonesMultipleSubs::computeRangesAndLocations()
m_locationOfSubs = validMeasuredDepths;
}
RimFishbonesCollection* collection;
this->firstAncestorOrThisOfTypeAsserted(collection);
collection->recalculateStartMD();
}
//--------------------------------------------------------------------------------------------------
@ -463,7 +468,7 @@ void RimFishbonesMultipleSubs::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTr
CVF_ASSERT(container);
size_t index = container->index(this);
m_name = QString("Fishbone %1").arg(index);
this->setName(QString("Fishbone %1").arg(index));
}
//--------------------------------------------------------------------------------------------------

View File

@ -81,6 +81,7 @@ public:
double tubingDiameter() const;
double holeDiameter() const { return m_pipeProperties()->holeDiameter(); }
double skinFactor() const { return m_pipeProperties()->skinFactor(); }
double openHoleRoughnessFactor() const { return m_lateralOpenHoleRoghnessFactor(); }
double icdOrificeDiameter() const { return m_icdOrificeDiameter(); }
double icdFlowCoefficient() const { return m_icdFlowCoefficient(); }

View File

@ -90,7 +90,7 @@ RimFracture::RimFracture(void)
CAF_PDM_InitField(&dip, "Dip", 0.0, "Dip", "", "", "");
CAF_PDM_InitField(&tilt, "Tilt", 0.0, "Tilt", "", "", "");
CAF_PDM_InitField(&showPolygonFractureOutline, "showPolygonFractureOutline", true, "Show Polygon Outline", "", "", "");
CAF_PDM_InitField(&fractureUnit, "fractureUnit", caf::AppEnum<RimDefines::UnitSystem>(RimDefines::UNITS_METRIC), "Fracture Unit System", "", "", "");
CAF_PDM_InitField(&fractureUnit, "fractureUnit", caf::AppEnum<RimUnitSystem::UnitSystem>(RimUnitSystem::UNITS_METRIC), "Fracture Unit System", "", "", "");
CAF_PDM_InitField(&stimPlanTimeIndexToPlot, "timeIndexToPlot", 0, "StimPlan Time Step", "", "", "");
@ -164,15 +164,15 @@ void RimFracture::fieldChangedByUi(const caf::PdmFieldHandle* changedField, cons
if (changedField == &fractureUnit)
{
if (fractureUnit == RimDefines::UNITS_METRIC)
if (fractureUnit == RimUnitSystem::UNITS_METRIC)
{
wellDiameter = RimDefines::inchToMeter(wellDiameter);
perforationLength = RimDefines::feetToMeter(perforationLength);
wellDiameter = RimUnitSystem::inchToMeter(wellDiameter);
perforationLength = RimUnitSystem::feetToMeter(perforationLength);
}
else if (fractureUnit == RimDefines::UNITS_FIELD)
else if (fractureUnit == RimUnitSystem::UNITS_FIELD)
{
wellDiameter = RimDefines::meterToInch(wellDiameter);
perforationLength = RimDefines::meterToFeet(perforationLength);
wellDiameter = RimUnitSystem::meterToInch(wellDiameter);
perforationLength = RimUnitSystem::meterToFeet(perforationLength);
}
this->updateConnectedEditors();
}
@ -264,13 +264,13 @@ void RimFracture::computeGeometry()
//--------------------------------------------------------------------------------------------------
double RimFracture::wellRadius() const
{
if (fractureUnit == RimDefines::UNITS_METRIC)
if (fractureUnit == RimUnitSystem::UNITS_METRIC)
{
return wellDiameter / 2;
}
else if (fractureUnit == RimDefines::UNITS_FIELD)
else if (fractureUnit == RimUnitSystem::UNITS_FIELD)
{
return RimDefines::inchToFeet(wellDiameter / 2);
return RimUnitSystem::inchToFeet(wellDiameter / 2);
}
return cvf::UNDEFINED_DOUBLE;
}
@ -398,12 +398,12 @@ QList<caf::PdmOptionItemInfo> RimFracture::calculateValueOptions(const caf::PdmF
//--------------------------------------------------------------------------------------------------
void RimFracture::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
if (fractureUnit == RimDefines::UNITS_METRIC)
if (fractureUnit == RimUnitSystem::UNITS_METRIC)
{
wellDiameter.uiCapability()->setUiName("Well Diameter [m]");
perforationLength.uiCapability()->setUiName("Perforation Length [m]");
}
else if (fractureUnit == RimDefines::UNITS_FIELD)
else if (fractureUnit == RimUnitSystem::UNITS_FIELD)
{
wellDiameter.uiCapability()->setUiName("Well Diameter [inches]");
perforationLength.uiCapability()->setUiName("Perforation Length [Ft]");

View File

@ -19,7 +19,7 @@
#pragma once
#include "RimCheckableNamedObject.h"
#include "RimDefines.h"
#include "RimUnitSystem.h"
#include "cvfBase.h"
#include "cvfObject.h"
@ -65,7 +65,7 @@ public:
caf::PdmField<int> stimPlanTimeIndexToPlot;
caf::PdmField<bool> showPolygonFractureOutline;
caf::PdmField< caf::AppEnum< RimDefines::UnitSystem > > fractureUnit;
caf::PdmField< RimUnitSystem::UnitSystemType > fractureUnit;
double wellRadius() const;
cvf::Vec3d anchorPosition() const ;

View File

@ -65,7 +65,7 @@ RimFractureTemplate::RimFractureTemplate(void)
CAF_PDM_InitObject("Fracture Template", ":/FractureTemplate16x16.png", "", "");
CAF_PDM_InitField(&name, "UserDescription", QString("Fracture Template"), "Name", "", "", "");
CAF_PDM_InitField(&fractureTemplateUnit, "fractureTemplateUnit", caf::AppEnum<RimDefines::UnitSystem>(RimDefines::UNITS_METRIC), "Units System", "", "", "");
CAF_PDM_InitField(&fractureTemplateUnit, "fractureTemplateUnit", caf::AppEnum<RimUnitSystem::UnitSystem>(RimUnitSystem::UNITS_METRIC), "Units System", "", "", "");
fractureTemplateUnit.uiCapability()->setUiReadOnly(true);
CAF_PDM_InitField(&orientation, "Orientation", caf::AppEnum<FracOrientationEnum>(TRANSVERSE_WELL_PATH), "Fracture Orientation", "", "", "");
@ -170,12 +170,12 @@ void RimFractureTemplate::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
void RimFractureTemplate::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
if (fractureTemplateUnit == RimDefines::UNITS_METRIC)
if (fractureTemplateUnit == RimUnitSystem::UNITS_METRIC)
{
wellDiameter.uiCapability()->setUiName("Well Diameter [m]");
perforationLength.uiCapability()->setUiName("Perforation Length [m]");
}
else if (fractureTemplateUnit == RimDefines::UNITS_FIELD)
else if (fractureTemplateUnit == RimUnitSystem::UNITS_FIELD)
{
wellDiameter.uiCapability()->setUiName("Well Diameter [inches]");
perforationLength.uiCapability()->setUiName("Perforation Length [Ft]");
@ -226,11 +226,11 @@ void RimFractureTemplate::defineEditorAttribute(const caf::PdmFieldHandle* field
//--------------------------------------------------------------------------------------------------
void RimFractureTemplate::setDefaultWellDiameterFromUnit()
{
if (fractureTemplateUnit == RimDefines::UNITS_FIELD)
if (fractureTemplateUnit == RimUnitSystem::UNITS_FIELD)
{
wellDiameter = 8.5;
}
else if (fractureTemplateUnit == RimDefines::UNITS_METRIC)
else if (fractureTemplateUnit == RimUnitSystem::UNITS_METRIC)
{
wellDiameter = 0.216;
}

View File

@ -18,7 +18,7 @@
#pragma once
#include "RimDefines.h"
#include "RimUnitSystem.h"
#include "cafAppEnum.h"
#include "cafPdmField.h"
@ -69,15 +69,15 @@ public:
};
caf::PdmField< caf::AppEnum< FracConductivityEnum > > fractureConductivity;
caf::PdmField< caf::AppEnum< RimDefines::UnitSystem > > fractureTemplateUnit;
caf::PdmField< RimUnitSystem::UnitSystemType > fractureTemplateUnit;
void setDefaultWellDiameterFromUnit();
virtual caf::PdmFieldHandle* userDescriptionField() override;
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
virtual void fractureGeometry(std::vector<cvf::Vec3f>* nodeCoords, std::vector<cvf::uint>* triangleIndices, RimDefines::UnitSystem fractureTemplateUnit) = 0;
virtual std::vector<cvf::Vec3f> fracturePolygon(RimDefines::UnitSystem fractureTemplateUnit) = 0;
virtual void fractureGeometry(std::vector<cvf::Vec3f>* nodeCoords, std::vector<cvf::uint>* triangleIndices, RimUnitSystem::UnitSystem fractureTemplateUnit) = 0;
virtual std::vector<cvf::Vec3f> fracturePolygon(RimUnitSystem::UnitSystem fractureTemplateUnit) = 0;
virtual const RigFractureGrid* fractureGrid() const = 0;

View File

@ -34,7 +34,7 @@ RimFractureTemplateCollection::RimFractureTemplateCollection(void)
{
CAF_PDM_InitObject("Fracture Templates", ":/FractureTemplates16x16.png", "", "");
CAF_PDM_InitField(&defaultUnitsForFracTemplates, "defaultUnitForFracTemplates", caf::AppEnum<RimDefines::UnitSystem>(RimDefines::UNITS_METRIC), "Default unit system for fracture templates", "", "", "");
CAF_PDM_InitField(&defaultUnitsForFracTemplates, "defaultUnitForFracTemplates", caf::AppEnum<RimUnitSystem::UnitSystem>(RimUnitSystem::UNITS_METRIC), "Default unit system for fracture templates", "", "", "");
CAF_PDM_InitFieldNoDefault(&fractureDefinitions, "FractureDefinitions", "", "", "", "");
fractureDefinitions.uiCapability()->setUiHidden(true);
}

View File

@ -18,7 +18,7 @@
#pragma once
#include "RimDefines.h"
#include "RimUnitSystem.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
@ -39,7 +39,7 @@ public:
virtual ~RimFractureTemplateCollection(void);
caf::PdmChildArrayField<RimFractureTemplate*> fractureDefinitions;
caf::PdmField< caf::AppEnum< RimDefines::UnitSystem > > defaultUnitsForFracTemplates;
caf::PdmField< RimUnitSystem::UnitSystemType > defaultUnitsForFracTemplates;
std::vector<std::pair<QString, QString> > stimPlanResultNamesAndUnits() const;
std::vector<QString> stimPlanResultNames() const;

View File

@ -40,8 +40,8 @@ RimPerforationCollection::RimPerforationCollection()
{
CAF_PDM_InitObject("Perforations", ":/PerforationIntervals16x16.png", "", "");
m_name.uiCapability()->setUiHidden(true);
m_name = "Perforations";
nameField()->uiCapability()->setUiHidden(true);
this->setName("Perforations");
CAF_PDM_InitFieldNoDefault(&m_perforations, "Perforations", "Perforations", "", "", "");
m_perforations.uiCapability()->setUiHidden(true);

View File

@ -46,7 +46,7 @@ RimPerforationInterval::RimPerforationInterval()
CAF_PDM_InitFieldNoDefault(&m_date, "StartDate", "Start Date", "", "", "");
m_date.uiCapability()->setUiEditorTypeName(caf::PdmUiLineEditor::uiEditorTypeName());
m_name.uiCapability()->setUiReadOnly(true);
nameField()->uiCapability()->setUiReadOnly(true);
}
//--------------------------------------------------------------------------------------------------
@ -153,7 +153,7 @@ void RimPerforationInterval::fieldChangedByUi(const caf::PdmFieldHandle* changed
//--------------------------------------------------------------------------------------------------
void RimPerforationInterval::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
{
m_name = QString("%1 - %2").arg(m_startMD).arg(m_endMD);
this->setName(QString("%1 - %2").arg(m_startMD).arg(m_endMD));
}
//--------------------------------------------------------------------------------------------------

View File

@ -184,7 +184,7 @@ void RimSimWellFracture::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderi
RimFracture::defineUiOrdering(uiConfigName, uiOrdering);
fractureUnit.uiCapability()->setUiReadOnly(true);
uiOrdering.add(&m_name);
uiOrdering.add(nameField());
uiOrdering.add(&showPolygonFractureOutline);
caf::PdmUiGroup* locationGroup = uiOrdering.addNewGroup("Location / Orientation");

View File

@ -245,12 +245,12 @@ void RimStimPlanFractureTemplate::readStimPlanXMLFile(QString * errorMessage)
{
if (unit == "md-ft")
{
fractureTemplateUnit = RimDefines::UNITS_FIELD;
fractureTemplateUnit = RimUnitSystem::UNITS_FIELD;
RiaLogging::info(QString("Setting unit system to Field for StimPlan fracture template %1").arg(name));
}
if (unit == "md-m")
{
fractureTemplateUnit = RimDefines::UNITS_METRIC;
fractureTemplateUnit = RimUnitSystem::UNITS_METRIC;
RiaLogging::info(QString("Setting unit system to Metric for StimPlan fracture template %1").arg(name));
}
}
@ -617,7 +617,7 @@ QString RimStimPlanFractureTemplate::getAttributeValueString(QXmlStreamReader &x
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimStimPlanFractureTemplate::fractureGeometry(std::vector<cvf::Vec3f>* nodeCoords, std::vector<cvf::uint>* triangleIndices, RimDefines::UnitSystem fractureUnit)
void RimStimPlanFractureTemplate::fractureGeometry(std::vector<cvf::Vec3f>* nodeCoords, std::vector<cvf::uint>* triangleIndices, RimUnitSystem::UnitSystem fractureUnit)
{
if (m_stimPlanFractureDefinitionData.isNull())
@ -636,17 +636,17 @@ void RimStimPlanFractureTemplate::fractureGeometry(std::vector<cvf::Vec3f>* node
RiaLogging::debug(QString("No conversion necessary for %1").arg(name));
}
else if (fractureTemplateUnit() == RimDefines::UNITS_METRIC && fractureUnit == RimDefines::UNITS_FIELD)
else if (fractureTemplateUnit() == RimUnitSystem::UNITS_METRIC && fractureUnit == RimUnitSystem::UNITS_FIELD)
{
RiaLogging::info(QString("Converting StimPlan geometry from metric to field for fracture template %1").arg(name));
for (double& value : adjustedDepths) value = RimDefines::meterToFeet(value);
for (double& value : xCoords) value = RimDefines::meterToFeet(value);
for (double& value : adjustedDepths) value = RimUnitSystem::meterToFeet(value);
for (double& value : xCoords) value = RimUnitSystem::meterToFeet(value);
}
else if (fractureTemplateUnit() == RimDefines::UNITS_FIELD && fractureUnit == RimDefines::UNITS_METRIC)
else if (fractureTemplateUnit() == RimUnitSystem::UNITS_FIELD && fractureUnit == RimUnitSystem::UNITS_METRIC)
{
RiaLogging::info(QString("Converting StimPlan geometry from field to metric for fracture template %1").arg(name));
for (double& value : adjustedDepths) value = RimDefines::feetToMeter(value);
for (double& value : xCoords) value = RimDefines::feetToMeter(value);
for (double& value : adjustedDepths) value = RimUnitSystem::feetToMeter(value);
for (double& value : xCoords) value = RimUnitSystem::feetToMeter(value);
}
else
{
@ -827,8 +827,8 @@ void RimStimPlanFractureTemplate::setupStimPlanCells()
std::vector<std::vector<double>> displayPropertyValuesAtTimeStep = getMirroredDataAtTimeIndex(resultNameFromColors, resultUnitFromColors, activeTimeStepIndex);
QString condUnit;
if (fractureTemplateUnit == RimDefines::UNITS_METRIC) condUnit = "md-m";
if (fractureTemplateUnit == RimDefines::UNITS_FIELD) condUnit = "md-ft";
if (fractureTemplateUnit == RimUnitSystem::UNITS_METRIC) condUnit = "md-m";
if (fractureTemplateUnit == RimUnitSystem::UNITS_FIELD) condUnit = "md-ft";
std::vector<std::vector<double>> conductivityValuesAtTimeStep = getMirroredDataAtTimeIndex("CONDUCTIVITY", condUnit, activeTimeStepIndex);
std::vector<double> depthCoordsAtNodes = adjustedDepthCoordsAroundWellPathPosition();
@ -952,7 +952,7 @@ std::vector<cvf::Vec3d> RimStimPlanFractureTemplate::getStimPlanColPolygon(size_
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<cvf::Vec3f> RimStimPlanFractureTemplate::fracturePolygon(RimDefines::UnitSystem fractureUnit)
std::vector<cvf::Vec3f> RimStimPlanFractureTemplate::fracturePolygon(RimUnitSystem::UnitSystem fractureUnit)
{
std::vector<cvf::Vec3f> polygon;
@ -1012,25 +1012,25 @@ std::vector<cvf::Vec3f> RimStimPlanFractureTemplate::fracturePolygon(RimDefines:
RiaLogging::debug(QString("No conversion necessary for %1").arg(name));
}
else if (fractureTemplateUnit() == RimDefines::UNITS_METRIC && fractureUnit == RimDefines::UNITS_FIELD)
else if (fractureTemplateUnit() == RimUnitSystem::UNITS_METRIC && fractureUnit == RimUnitSystem::UNITS_FIELD)
{
RiaLogging::info(QString("Converting StimPlan geometry from metric to field for fracture template %1").arg(name));
for (cvf::Vec3f& node : polygon)
{
float x = RimDefines::meterToFeet(node.x());
float y = RimDefines::meterToFeet(node.y());
float z = RimDefines::meterToFeet(node.z());
float x = RimUnitSystem::meterToFeet(node.x());
float y = RimUnitSystem::meterToFeet(node.y());
float z = RimUnitSystem::meterToFeet(node.z());
node = cvf::Vec3f(x, y, z);
}
}
else if (fractureTemplateUnit() == RimDefines::UNITS_FIELD && fractureUnit == RimDefines::UNITS_METRIC)
else if (fractureTemplateUnit() == RimUnitSystem::UNITS_FIELD && fractureUnit == RimUnitSystem::UNITS_METRIC)
{
RiaLogging::info(QString("Converting StimPlan geometry from field to metric for fracture template %1").arg(name));
for (cvf::Vec3f& node : polygon)
{
float x = RimDefines::feetToMeter(node.x());
float y = RimDefines::feetToMeter(node.y());
float z = RimDefines::feetToMeter(node.z());
float x = RimUnitSystem::feetToMeter(node.x());
float y = RimUnitSystem::feetToMeter(node.y());
float z = RimUnitSystem::feetToMeter(node.z());
node = cvf::Vec3f(x, y, z);
}
}

View File

@ -66,8 +66,8 @@ public:
const QString& fileName();
QString fileNameWithOutPath();
void fractureGeometry(std::vector<cvf::Vec3f>* nodeCoords, std::vector<cvf::uint>* triangleIndices, RimDefines::UnitSystem fractureUnit) override;
std::vector<cvf::Vec3f> fracturePolygon(RimDefines::UnitSystem fractureUnit);
void fractureGeometry(std::vector<cvf::Vec3f>* nodeCoords, std::vector<cvf::uint>* triangleIndices, RimUnitSystem::UnitSystem fractureUnit) override;
std::vector<cvf::Vec3f> fracturePolygon(RimUnitSystem::UnitSystem fractureUnit);
void sortPolygon(std::vector<cvf::Vec3f> &polygon);
std::vector<double> getStimPlanTimeValues();

View File

@ -159,7 +159,7 @@ void RimWellPathFracture::defineUiOrdering(QString uiConfigName, caf::PdmUiOrder
{
RimFracture::defineUiOrdering(uiConfigName, uiOrdering);
uiOrdering.add(&m_name);
uiOrdering.add(nameField());
uiOrdering.add(&showPolygonFractureOutline);
caf::PdmUiGroup* locationGroup = uiOrdering.addNewGroup("Location / Orientation");

View File

@ -19,6 +19,7 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RimDefines.h"
#include "cafAppEnum.h"
@ -56,16 +57,6 @@ namespace caf
setDefault(RimDefines::UNIT_METER);
}
template<>
void caf::AppEnum< RimDefines::UnitSystem >::setUp()
{
addItem(RimDefines::UNITS_METRIC, "UNITS_METRIC", "Metric");
addItem(RimDefines::UNITS_FIELD, "UNITS_FIELD", "Field");
setDefault(RimDefines::UNITS_METRIC);
}
template<>
void caf::AppEnum< RimDefines::PlotAxis >::setUp()
{

View File

@ -92,25 +92,6 @@ public:
};
enum UnitSystem
{
UNITS_METRIC,
UNITS_FIELD
//UNITS_LAB
};
static double feetPerMeter() { return 3.2808399; }
static double meterPerFeet() { return 0.3048000; }
static double meterToFeet(double meter) { return meter*feetPerMeter(); }
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.0)*meterPerFeet(); }
static double inchToFeet (double inch) { return (inch / 12.0); }
// Defines relate to plotting
enum PlotAxis

View File

@ -390,9 +390,9 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep)
caf::AppEnum<RimDefines::CompletionType> fishbone(RimDefines::FISHBONES);
caf::AppEnum<RimDefines::CompletionType> perforationInterval(RimDefines::PERFORATION_INTERVAL);
categories.push_back(std::make_tuple(wellPath.uiText(), wellPath.index(), cvf::Color3::RED));
categories.push_back(std::make_tuple(fishbone.uiText(), fishbone.index(), cvf::Color3::DARK_GREEN));
categories.push_back(std::make_tuple(perforationInterval.uiText(), perforationInterval.index(), cvf::Color3::GREEN));
categories.push_back(std::make_tuple(wellPath.uiText(), static_cast<int>(wellPath.index()), cvf::Color3::RED));
categories.push_back(std::make_tuple(fishbone.uiText(), static_cast<int>(fishbone.index()), cvf::Color3::DARK_GREEN));
categories.push_back(std::make_tuple(perforationInterval.uiText(), static_cast<int>(perforationInterval.index()), cvf::Color3::GREEN));
legendConfig()->setCategoryItems(categories);
}

View File

@ -56,6 +56,14 @@ void RimNamedObject::setName(const QString& name)
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimNamedObject::userDescriptionField()
{
return nameField();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimNamedObject::nameField()
{
return &m_name;
}

View File

@ -39,8 +39,11 @@ public:
protected:
virtual caf::PdmFieldHandle* userDescriptionField() override;
// To be used from derived objects when manipulating visibility and ui ordering
caf::PdmFieldHandle* nameField();
protected:
private:
caf::PdmField<QString> m_name;
};

View File

@ -53,8 +53,8 @@ RimStimPlanColors::RimStimPlanColors()
CAF_PDM_InitFieldNoDefault(&m_legendConfigurations, "LegendConfigurations", "", "", "", "");
m_legendConfigurations.uiCapability()->setUiTreeHidden(true);
m_name = "Fracture Colors";
m_name.uiCapability()->setUiReadOnly(true);
setName("Fracture Colors");
nameField()->uiCapability()->setUiReadOnly(true);
}
//--------------------------------------------------------------------------------------------------

View File

@ -0,0 +1,59 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017- Statoil ASA
//
// ResInsight 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.
//
// ResInsight 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimUnitSystem.h"
#include "cafAppEnum.h"
#include "cvfAssert.h"
namespace caf
{
template<>
void RimUnitSystem::UnitSystemType::setUp()
{
addItem(RimUnitSystem::UNITS_METRIC, "UNITS_METRIC", "Metric");
addItem(RimUnitSystem::UNITS_FIELD, "UNITS_FIELD", "Field");
addItem(RimUnitSystem::UNITS_UNKNOWN, "UNITS_UNKNOWN", "Unknown");
setDefault(RimUnitSystem::UNITS_METRIC);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimUnitSystem::darcysConstant(UnitSystem unitSystem)
{
// 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)
switch (unitSystem)
{
case UNITS_FIELD:
return 0.001127;
case UNITS_METRIC:
return 0.008527;
default:
CVF_ASSERT(false);
return 0.0;
}
}

View File

@ -0,0 +1,48 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017- Statoil ASA
//
// ResInsight 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.
//
// ResInsight 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafAppEnum.h"
class RimUnitSystem
{
public:
enum UnitSystem
{
UNITS_METRIC,
UNITS_FIELD,
UNITS_UNKNOWN,
//UNITS_LAB
};
typedef caf::AppEnum< RimUnitSystem::UnitSystem > UnitSystemType;
static double feetPerMeter() { return 3.2808399; }
static double meterPerFeet() { return 0.3048000; }
static double meterToFeet(double meter) { return meter*feetPerMeter(); }
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

@ -92,6 +92,9 @@ RimWellPath::RimWellPath()
m_datumElevation.xmlCapability()->setIOWritable(false);
m_datumElevation.xmlCapability()->setIOReadable(false);
CAF_PDM_InitFieldNoDefault(&m_unitSystem, "UnitSystem", "Unit System", "", "", "");
m_unitSystem.uiCapability()->setUiReadOnly(true);
CAF_PDM_InitField(&filepath, "WellPathFilepath", QString(""), "Filepath", "", "", "");
filepath.uiCapability()->setUiReadOnly(true);
CAF_PDM_InitField(&wellPathIndexInFile, "WellPathNumberInFile", -1, "Well Number in file", "", "", "");
@ -329,6 +332,7 @@ void RimWellPath::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiO
ssihubGroup->add(&updateUser);
ssihubGroup->add(&m_surveyType);
ssihubGroup->add(&m_datumElevation);
ssihubGroup->add(&m_unitSystem);
if (m_wellPath.notNull() && m_wellPath->hasDatumElevation())
{
@ -455,6 +459,22 @@ double RimWellPath::combinedScaleFactor() const
return this->wellPathRadiusScaleFactor() * wellPathColl->wellPathRadiusScaleFactor();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPath::setUnitSystem(RimUnitSystem::UnitSystem unitSystem)
{
m_unitSystem = unitSystem;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimUnitSystem::UnitSystem RimWellPath::unitSystem() const
{
return m_unitSystem();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -20,6 +20,8 @@
#pragma once
#include "RimUnitSystem.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
@ -93,6 +95,9 @@ public:
double combinedScaleFactor() const;
void setUnitSystem(RimUnitSystem::UnitSystem unitSystem);
RimUnitSystem::UnitSystem unitSystem() const;
private:
void setWellPathGeometry(RigWellPath* wellPathModel);
@ -115,6 +120,8 @@ private:
caf::PdmField<QString> m_surveyType;
caf::PdmField<double> m_datumElevation;
caf::PdmField<RimUnitSystem::UnitSystemType> m_unitSystem;
caf::PdmChildField<RimWellPathCompletions*> m_completions;

View File

@ -25,10 +25,15 @@
#include "RiaColorTables.h"
#include "RigWellPath.h"
#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
#include "RimProject.h"
#include "RimWellLogFile.h"
#include "RimWellPath.h"
#include "RimOilField.h"
#include "RimEclipseCase.h"
#include "RimEclipseCaseCollection.h"
#include "RiuMainWindow.h"
@ -169,7 +174,7 @@ void RimWellPathCollection::addWellPaths( QStringList filePaths )
{
std::vector<RimWellPath*> wellPathArray;
foreach (QString filePath, filePaths)
for (QString filePath : filePaths)
{
// Check if this file is already open
bool alreadyOpen = false;
@ -258,6 +263,7 @@ void RimWellPathCollection::readAndAddWellPaths(std::vector<RimWellPath*>& wellP
else
{
wellPath->wellPathColor = cvf::Color3f(interpolatedWellColors[wpIdx]);
wellPath->setUnitSystem(findUnitSystemForWellPath(wellPath));
wellPaths.push_back(wellPath);
}
@ -391,6 +397,9 @@ void RimWellPathCollection::removeWellPath(RimWellPath* wellPath)
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool lessWellPath(const caf::PdmPointer<RimWellPath>& w1, const caf::PdmPointer<RimWellPath>& w2)
{
if (w1.notNull() && w2.notNull())
@ -408,3 +417,37 @@ void RimWellPathCollection::sortWellsByName()
{
std::sort(wellPaths.begin(), wellPaths.end(), lessWellPath);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimUnitSystem::UnitSystemType RimWellPathCollection::findUnitSystemForWellPath(const RimWellPath* wellPath)
{
RimProject* project;
firstAncestorOrThisOfTypeAsserted(project);
if (project->activeOilField()->analysisModels->cases.empty())
{
return RimUnitSystem::UNITS_UNKNOWN;
}
const RigEclipseCaseData* eclipseCaseData = project->activeOilField()->analysisModels->cases()[0]->eclipseCaseData();
cvf::BoundingBox caseBoundingBox = eclipseCaseData->mainGrid()->boundingBox();
cvf::BoundingBox wellPathBoundingBox;
for (auto& wellPathPoint : wellPath->wellPathGeometry()->m_wellPathPoints)
{
wellPathBoundingBox.add(wellPathPoint);
}
if (caseBoundingBox.intersects(wellPathBoundingBox))
{
if (eclipseCaseData->unitsType() == RigEclipseCaseData::UNITS_FIELD)
{
return RimUnitSystem::UNITS_FIELD;
}
else if (eclipseCaseData->unitsType() == RigEclipseCaseData::UNITS_METRIC)
{
return RimUnitSystem::UNITS_METRIC;
}
}
return RimUnitSystem::UNITS_UNKNOWN;
}

View File

@ -20,6 +20,8 @@
#pragma once
#include "RimUnitSystem.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
@ -104,6 +106,8 @@ private:
void readAndAddWellPaths(std::vector<RimWellPath*>& wellPathArray);
void sortWellsByName();
RimUnitSystem::UnitSystemType findUnitSystemForWellPath(const RimWellPath* wellPath);
cvf::ref<RivWellPathCollectionPartMgr> m_wellPathCollectionPartManager;
RifWellPathImporter* m_wellPathImporter;

View File

@ -15,6 +15,7 @@ ${CEE_CURRENT_LIST_DIR}RigResultAccessorFactory.h
${CEE_CURRENT_LIST_DIR}RigAllGridCellsResultAccessor.h
${CEE_CURRENT_LIST_DIR}RigActiveCellsResultAccessor.h
${CEE_CURRENT_LIST_DIR}RigCellEdgeResultAccessor.h
${CEE_CURRENT_LIST_DIR}RigCellGeometryTools.h
${CEE_CURRENT_LIST_DIR}RigCombTransResultAccessor.h
${CEE_CURRENT_LIST_DIR}RigCombMultResultAccessor.h
${CEE_CURRENT_LIST_DIR}RigCompletionData.h
@ -67,6 +68,8 @@ ${CEE_CURRENT_LIST_DIR}RigStimPlanUpscalingCalc.h
${CEE_CURRENT_LIST_DIR}RigFractureGrid.h
${CEE_CURRENT_LIST_DIR}RigFractureCell.h
${CEE_CURRENT_LIST_DIR}RigWellPathIntersectionTools.h
${CEE_CURRENT_LIST_DIR}RigTransmissibilityEquations.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -80,6 +83,7 @@ ${CEE_CURRENT_LIST_DIR}RigResultAccessorFactory.cpp
${CEE_CURRENT_LIST_DIR}RigAllGridCellsResultAccessor.cpp
${CEE_CURRENT_LIST_DIR}RigActiveCellsResultAccessor.cpp
${CEE_CURRENT_LIST_DIR}RigCellEdgeResultAccessor.cpp
${CEE_CURRENT_LIST_DIR}RigCellGeometryTools.cpp
${CEE_CURRENT_LIST_DIR}RigCombTransResultAccessor.cpp
${CEE_CURRENT_LIST_DIR}RigCombMultResultAccessor.cpp
${CEE_CURRENT_LIST_DIR}RigCompletionData.cpp
@ -127,6 +131,8 @@ ${CEE_CURRENT_LIST_DIR}RigStimPlanUpscalingCalc.cpp
${CEE_CURRENT_LIST_DIR}RigFractureGrid.cpp
${CEE_CURRENT_LIST_DIR}RigFractureCell.cpp
${CEE_CURRENT_LIST_DIR}RigWellPathIntersectionTools.cpp
${CEE_CURRENT_LIST_DIR}RigTransmissibilityEquations.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -28,21 +28,6 @@
#include <vector>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigCellGeometryTools::RigCellGeometryTools()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigCellGeometryTools::~RigCellGeometryTools()
{
}
//--------------------------------------------------------------------------------------------------
///
@ -155,10 +140,10 @@ void RigCellGeometryTools::createPolygonFromLineSegments(std::list<std::pair<cvf
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigCellGeometryTools::findCellLocalXYZ(cvf::Vec3d * hexCorners, cvf::Vec3d &localXdirection, cvf::Vec3d &localYdirection, cvf::Vec3d &localZdirection)
//==================================================================================================
///
//==================================================================================================
void RigCellGeometryTools::findCellLocalXYZ(const std::array<cvf::Vec3d, 8>& hexCorners, cvf::Vec3d& localXdirection, cvf::Vec3d& localYdirection, cvf::Vec3d& localZdirection)
{
cvf::ubyte faceVertexIndices[4];
cvf::StructGridInterface::FaceEnum face;
@ -179,7 +164,7 @@ void RigCellGeometryTools::findCellLocalXYZ(cvf::Vec3d * hexCorners, cvf::Vec3d
face = cvf::StructGridInterface::POS_J;
cvf::StructGridInterface::cellFaceVertexIndices(face, faceVertexIndices);
cvf::Vec3d faceCenterPosJ = cvf::GeometryTools::computeFaceCenter(hexCorners[faceVertexIndices[0]], hexCorners[faceVertexIndices[1]], hexCorners[faceVertexIndices[2]], hexCorners[faceVertexIndices[3]]);
cvf::Vec3d faceCenterCenterVectorI = faceCenterPosI - faceCenterNegI;
cvf::Vec3d faceCenterCenterVectorJ = faceCenterPosJ - faceCenterNegJ;
@ -195,7 +180,7 @@ void RigCellGeometryTools::findCellLocalXYZ(cvf::Vec3d * hexCorners, cvf::Vec3d
crossPoductIZ.cross(faceCenterCenterVectorI, localZdirection);
localYdirection = faceCenterCenterVectorJ - crossPoductIZ;
localYdirection.normalize();
//TODO: Check if we end up with 0-vectors, and handle this case...
}

View File

@ -24,6 +24,7 @@
#include "cvfBoundingBox.h"
#include "cvfPlane.h"
#include <array>
#include <list>
#include <vector>
@ -39,8 +40,8 @@ public:
static void createPolygonFromLineSegments(std::list<std::pair<cvf::Vec3d, cvf::Vec3d>> &intersectionLineSegments, std::vector<std::vector<cvf::Vec3d>> &polygons);
static void findCellLocalXYZ(cvf::Vec3d * hexCorners, cvf::Vec3d &localXdirection, cvf::Vec3d &localYdirection, cvf::Vec3d &localZdirection);
static void findCellLocalXYZ(const std::array<cvf::Vec3d, 8>& hexCorners, cvf::Vec3d &localXdirection, cvf::Vec3d &localYdirection, cvf::Vec3d &localZdirection);
static double polygonAreaWeightedLength(cvf::Vec3d directionOfLength, std::vector<cvf::Vec3d> polygon2d);
static std::vector<std::vector<cvf::Vec3d> > intersectPolygons(std::vector<cvf::Vec3d> polygon1, std::vector<cvf::Vec3d> polygon2);

View File

@ -125,6 +125,15 @@ void RigCompletionData::setFromFishbone(double diameter, CellDirection direction
m_direction = direction;
}
//==================================================================================================
///
//==================================================================================================
void RigCompletionData::setFromFishbone(double transmissibility, double skinFactor)
{
m_transmissibility = transmissibility;
m_skinFactor = skinFactor;
}
//==================================================================================================
///
//==================================================================================================

View File

@ -102,6 +102,7 @@ public:
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 addMetadata(const QString& name, const QString& comment);
static bool isDefaultValue(double val);

View File

@ -132,11 +132,11 @@ void RigEclipseToStimPlanCellTransmissibilityCalculator::calculateStimPlanCellsM
double NTG = dataAccessObjectNTG->cellScalarGlobIdx(fracCell);
const RigMainGrid* mainGrid = m_case->eclipseCaseData()->mainGrid();
cvf::Vec3d hexCorners[8];
mainGrid->cellCornerVertices(fracCell, hexCorners);
std::array<cvf::Vec3d, 8> hexCorners;
mainGrid->cellCornerVertices(fracCell, hexCorners.data());
std::vector<std::vector<cvf::Vec3d> > planeCellPolygons;
bool isPlanIntersected = RigFractureTransCalc::planeCellIntersectionPolygons(hexCorners, m_fractureTransform, planeCellPolygons);
bool isPlanIntersected = RigFractureTransCalc::planeCellIntersectionPolygons(hexCorners.data(), m_fractureTransform, planeCellPolygons);
if (!isPlanIntersected || planeCellPolygons.size() == 0) continue;
cvf::Vec3d localX;

View File

@ -60,19 +60,19 @@ RigFractureTransCalc::RigFractureTransCalc(RimEclipseCase* caseToApply, RimFract
if (caseUnit == RigEclipseCaseData::UNITS_METRIC)
{
RiaLogging::debug(QString("Calculating transmissibilities in metric units"));
m_unitForCalculation = RimDefines::UNITS_METRIC;
m_unitForCalculation = RimUnitSystem::UNITS_METRIC;
}
else if (caseUnit == RigEclipseCaseData::UNITS_FIELD)
{
RiaLogging::debug(QString("Calculating transmissibilities in field units"));
m_unitForCalculation = RimDefines::UNITS_FIELD;
m_unitForCalculation = RimUnitSystem::UNITS_FIELD;
}
else
{
//TODO: How to handle lab units for eclipse case?
RiaLogging::error(QString("Unit system for case not supported for fracture export."));
RiaLogging::error(QString("Export will be in metric units, but results might be wrong."));
m_unitForCalculation = RimDefines::UNITS_METRIC;
m_unitForCalculation = RimUnitSystem::UNITS_METRIC;
}
@ -134,11 +134,11 @@ std::vector<RigFracturedEclipseCellExportData> RigFractureTransCalc::computeTra
double NTG = dataAccessObjectNTG->cellScalarGlobIdx(fracCell);
const RigMainGrid* mainGrid = m_case->eclipseCaseData()->mainGrid();
cvf::Vec3d hexCorners[8];
mainGrid->cellCornerVertices(fracCell, hexCorners);
std::array<cvf::Vec3d, 8> hexCorners;
mainGrid->cellCornerVertices(fracCell, hexCorners.data());
std::vector<std::vector<cvf::Vec3d> > planeCellPolygons;
bool isPlanIntersected = planeCellIntersectionPolygons(hexCorners, m_fracture->transformMatrix(), planeCellPolygons);
bool isPlanIntersected = planeCellIntersectionPolygons(hexCorners.data(), m_fracture->transformMatrix(), planeCellPolygons);
if (!isPlanIntersected || planeCellPolygons.size() == 0) continue;
cvf::Vec3d localX;
@ -284,18 +284,18 @@ bool RigFractureTransCalc::planeCellIntersectionPolygons(cvf::Vec3d hexCorners[8
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigFractureTransCalc::convertConductivtyValue(double Kw, RimDefines::UnitSystem fromUnit, RimDefines::UnitSystem toUnit)
double RigFractureTransCalc::convertConductivtyValue(double Kw, RimUnitSystem::UnitSystem fromUnit, RimUnitSystem::UnitSystem toUnit)
{
if (fromUnit == toUnit) return Kw;
else if (fromUnit == RimDefines::UNITS_METRIC && toUnit == RimDefines::UNITS_FIELD)
else if (fromUnit == RimUnitSystem::UNITS_METRIC && toUnit == RimUnitSystem::UNITS_FIELD)
{
return RimDefines::meterToFeet(Kw);
return RimUnitSystem::meterToFeet(Kw);
}
else if (fromUnit == RimDefines::UNITS_METRIC && toUnit == RimDefines::UNITS_FIELD)
else if (fromUnit == RimUnitSystem::UNITS_METRIC && toUnit == RimUnitSystem::UNITS_FIELD)
{
return RimDefines::feetToMeter(Kw);
return RimUnitSystem::feetToMeter(Kw);
}
return cvf::UNDEFINED_DOUBLE;

View File

@ -19,7 +19,7 @@
#pragma once
#include "RimDefines.h"
#include "RimUnitSystem.h"
#include "cafAppEnum.h"
@ -54,11 +54,11 @@ public:
std::vector<std::vector<cvf::Vec3d> > & polygons);
private:
static double convertConductivtyValue(double Kw, RimDefines::UnitSystem fromUnit, RimDefines::UnitSystem toUnit);
static double convertConductivtyValue(double Kw, RimUnitSystem::UnitSystem fromUnit, RimUnitSystem::UnitSystem toUnit);
private:
RimEclipseCase* m_case;
RimFracture* m_fracture;
RimDefines::UnitSystem m_unitForCalculation;
RimUnitSystem::UnitSystem m_unitForCalculation;
};

View File

@ -24,19 +24,19 @@ RigStimPlanUpscalingCalc::RigStimPlanUpscalingCalc(RimEclipseCase* caseToApply,
if (caseUnit == RigEclipseCaseData::UNITS_METRIC)
{
RiaLogging::debug(QString("Calculating transmissibilities in metric units"));
m_unitForCalculation = RimDefines::UNITS_METRIC;
m_unitForCalculation = RimUnitSystem::UNITS_METRIC;
}
else if (caseUnit == RigEclipseCaseData::UNITS_FIELD)
{
RiaLogging::debug(QString("Calculating transmissibilities in field units"));
m_unitForCalculation = RimDefines::UNITS_FIELD;
m_unitForCalculation = RimUnitSystem::UNITS_FIELD;
}
else
{
//TODO: How to handle lab units for eclipse case?
RiaLogging::error(QString("Unit system for case not supported for fracture export."));
RiaLogging::error(QString("Export will be in metric units, but results might be wrong."));
m_unitForCalculation = RimDefines::UNITS_METRIC;
m_unitForCalculation = RimUnitSystem::UNITS_METRIC;
}
}
@ -44,7 +44,7 @@ RigStimPlanUpscalingCalc::RigStimPlanUpscalingCalc(RimEclipseCase* caseToApply,
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::pair<double, double> RigStimPlanUpscalingCalc::flowAcrossLayersUpscaling(QString resultName, QString resultUnit, size_t timeStepIndex, RimDefines::UnitSystem unitSystem, size_t eclipseCellIndex)
std::pair<double, double> RigStimPlanUpscalingCalc::flowAcrossLayersUpscaling(QString resultName, QString resultUnit, size_t timeStepIndex, RimUnitSystem::UnitSystem unitSystem, size_t eclipseCellIndex)
{
RimStimPlanFractureTemplate* fracTemplateStimPlan;
if (dynamic_cast<RimStimPlanFractureTemplate*>(m_fracture->attachedFractureDefinition()))

View File

@ -13,7 +13,7 @@ public:
std::vector<RigFracturedEclipseCellExportData> computeUpscaledPropertyFromStimPlan(QString resultName, QString resultUnit, size_t timeStepIndex);
private:
std::pair<double, double> flowAcrossLayersUpscaling(QString resultName, QString resultUnit, size_t timeStepIndex, RimDefines::UnitSystem unitSystem, size_t eclipseCellIndex);
std::pair<double, double> flowAcrossLayersUpscaling(QString resultName, QString resultUnit, size_t timeStepIndex, RimUnitSystem::UnitSystem unitSystem, size_t eclipseCellIndex);
double computeHAupscale(RimStimPlanFractureTemplate* fracTemplateStimPlan, std::vector<RigFractureCell> stimPlanCells, std::vector<cvf::Vec3d> planeCellPolygon, cvf::Vec3d directionAlongLayers, cvf::Vec3d directionAcrossLayers);
double computeAHupscale(RimStimPlanFractureTemplate* fracTemplateStimPlan, std::vector<RigFractureCell> stimPlanCells, std::vector<cvf::Vec3d> planeCellPolygon, cvf::Vec3d directionAlongLayers, cvf::Vec3d directionAcrossLayers);
static double arithmeticAverage(std::vector<double> values);
@ -24,7 +24,7 @@ private:
private:
RimEclipseCase* m_case;
RimFracture* m_fracture;
RimDefines::UnitSystem m_unitForCalculation;
RimUnitSystem::UnitSystem m_unitForCalculation;
};

View File

@ -0,0 +1,82 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017- Statoil ASA
//
// ResInsight 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.
//
// ResInsight 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RigTransmissibilityEquations.h"
#include "cvfBase.h"
#include "cvfMath.h"
#include <cmath>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigTransmissibilityEquations::peacemanRadius(double permeabilityNormalDirection1,
double permeabilityNormalDirection2,
double cellSizeNormalDirection1,
double cellSizeNormalDirection2)
{
double nominator = cvf::Math::sqrt(
pow(cellSizeNormalDirection2, 2) + pow(permeabilityNormalDirection1 / permeabilityNormalDirection2, 1 / 2)
+ pow(cellSizeNormalDirection1, 2) + pow(permeabilityNormalDirection2 / permeabilityNormalDirection1, 1 / 2));
double denominator = pow((permeabilityNormalDirection1 / permeabilityNormalDirection2), 1 / 4)
+ pow((permeabilityNormalDirection2 / permeabilityNormalDirection1), 1 / 4);
double r0 = 0.28 * nominator / denominator;
return r0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigTransmissibilityEquations::wellBoreTransmissibilityComponent(double cellPerforationVectorComponent,
double permeabilityNormalDirection1,
double permeabilityNormalDirection2,
double cellSizeNormalDirection1,
double cellSizeNormalDirection2,
double wellRadius,
double skinFactor,
double cDarcyForRelevantUnit)
{
double K = cvf::Math::sqrt(permeabilityNormalDirection1 * permeabilityNormalDirection2);
double nominator = cDarcyForRelevantUnit * 2 * cvf::PI_D * K * cellPerforationVectorComponent;
double peaceManRad = peacemanRadius(permeabilityNormalDirection1,
permeabilityNormalDirection2,
cellSizeNormalDirection1,
cellSizeNormalDirection2);
double denominator = log(peaceManRad / wellRadius) + skinFactor;
double trans = nominator / denominator;
return trans;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigTransmissibilityEquations::totalConnectionFactor(double transX, double transY, double transZ)
{
return cvf::Math::sqrt(
pow(transX, 2.0) + pow(transY, 2.0) + pow(transZ, 2));
}

View File

@ -0,0 +1,52 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017- Statoil ASA
//
// ResInsight 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.
//
// ResInsight 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
class RigTransmissibilityEquations
{
public:
// Calculations are assuming an orthogonal coordinate system
// If using wellBoreTransmissibilityComponent to calculate Tx (transmissibility in x direction),
// perforationVectorComponent is the x component (in the cell local coordinate system) of the perforation vector
// permeability and cell size for Z and Y are to be specified as "normal directions" 1 and 2
// but normal directions 1 and 2 are interchangeable (so Z=1, Y=2 and Z=2, Y=1 gives same result)
static double peacemanRadius(double permeabilityNormalDirection1,
double permeabilityNormalDirection2,
double cellSizeNormalDirection1,
double cellSizeNormalDirection2);
static double wellBoreTransmissibilityComponent(double cellPerforationVectorComponent,
double permeabilityNormalDirection1,
double permeabilityNormalDirection2,
double cellSizeNormalDirection1,
double cellSizeNormalDirection2,
double wellRadius,
double skinFactor,
double cDarcyForRelevantUnit);
static double totalConnectionFactor(double transX,
double transY,
double transZ);
};

View File

@ -21,6 +21,8 @@
#include "RigCurveDataTools.h"
#include "RimUnitSystem.h"
#include "cvfMath.h"
#include "cvfAssert.h"
@ -366,7 +368,7 @@ std::vector<double> RigWellLogCurveData::convertFromMeterToFeet(const std::vecto
for (size_t i = 0; i < valuesInMeter.size(); i++)
{
valuesInFeet[i] = valuesInMeter[i] * RimDefines::feetPerMeter();
valuesInFeet[i] = valuesInMeter[i] * RimUnitSystem::feetPerMeter();
}
return valuesInFeet;
@ -381,7 +383,7 @@ std::vector<double> RigWellLogCurveData::convertFromFeetToMeter(const std::vecto
for (size_t i = 0; i < valuesInFeet.size(); i++)
{
valuesInMeter[i] = valuesInFeet[i] / RimDefines::feetPerMeter();
valuesInMeter[i] = valuesInFeet[i] / RimUnitSystem::feetPerMeter();
}
return valuesInMeter;

View File

@ -24,6 +24,7 @@
#include "RigMainGrid.h"
#include "RigEclipseCaseData.h"
#include "RigWellLogExtractionTools.h"
#include "RigCellGeometryTools.h"
#include "cvfGeometryTools.h"
#include "cvfMatrix3.h"
@ -46,7 +47,7 @@ std::vector<WellPathCellIntersectionInfo> RigWellPathIntersectionTools::findCell
cvf::Vec3d startPoint;
cvf::Vec3d endPoint;
size_t cellIndex;
WellPathCellDirection direction;
cvf::Vec3d internalCellLengths;
auto intersection = intersections.cbegin();
@ -58,8 +59,8 @@ std::vector<WellPathCellIntersectionInfo> RigWellPathIntersectionTools::findCell
if (foundCell)
{
endPoint = intersection->m_intersectionPoint;
direction = calculateDirectionInCell(grid, cellIndex, startPoint, endPoint);
intersectionInfo.push_back(WellPathCellIntersectionInfo(cellIndex, direction, startPoint, endPoint));
internalCellLengths = calculateLengthInCell(grid, cellIndex, startPoint, endPoint);
intersectionInfo.push_back(WellPathCellIntersectionInfo(cellIndex, startPoint, endPoint, internalCellLengths));
}
else
{
@ -75,8 +76,8 @@ std::vector<WellPathCellIntersectionInfo> RigWellPathIntersectionTools::findCell
while (intersection != intersections.cend())
{
endPoint = intersection->m_intersectionPoint;
direction = calculateDirectionInCell(grid, cellIndex, startPoint, endPoint);
intersectionInfo.push_back(WellPathCellIntersectionInfo(cellIndex, direction, startPoint, endPoint));
internalCellLengths = calculateLengthInCell(grid, cellIndex, startPoint, endPoint);
intersectionInfo.push_back(WellPathCellIntersectionInfo(cellIndex, startPoint, endPoint, internalCellLengths));
startPoint = endPoint;
cellIndex = intersection->m_hexIndex;
@ -86,8 +87,8 @@ std::vector<WellPathCellIntersectionInfo> RigWellPathIntersectionTools::findCell
if (includeEndCell)
{
endPoint = coords[coords.size() - 1];
direction = calculateDirectionInCell(grid, cellIndex, startPoint, endPoint);
intersectionInfo.push_back(WellPathCellIntersectionInfo(cellIndex, direction, startPoint, endPoint));
internalCellLengths = calculateLengthInCell(grid, cellIndex, startPoint, endPoint);
intersectionInfo.push_back(WellPathCellIntersectionInfo(cellIndex, startPoint, endPoint, internalCellLengths));
}
return intersectionInfo;
@ -108,123 +109,52 @@ std::vector<HexIntersectionInfo> RigWellPathIntersectionTools::getIntersectedCel
std::vector<size_t> closeCells = findCloseCells(grid, bb);
cvf::Vec3d hexCorners[8];
std::array<cvf::Vec3d, 8> hexCorners;
for (size_t closeCell : closeCells)
{
const RigCell& cell = grid->globalCellArray()[closeCell];
if (cell.isInvalid()) continue;
setHexCorners(cell, nodeCoords, hexCorners);
grid->cellCornerVertices(closeCell, hexCorners.data());
RigHexIntersector::lineHexCellIntersection(coords[i], coords[i + 1], hexCorners, closeCell, &intersections);
RigHexIntersector::lineHexCellIntersection(coords[i], coords[i + 1], hexCorners.data(), closeCell, &intersections);
}
}
return intersections;
}
//--------------------------------------------------------------------------------------------------
/// Calculates main axis vectors for each axis in the cell.
//--------------------------------------------------------------------------------------------------
void RigWellPathIntersectionTools::calculateCellMainAxisVectors(const std::array<cvf::Vec3d, 8>& hexCorners, cvf::Vec3d* iAxisDirection, cvf::Vec3d* jAxisDirection, cvf::Vec3d* kAxisDirection)
{
*iAxisDirection = calculateCellMainAxisVector(hexCorners, cvf::StructGridInterface::NEG_I, cvf::StructGridInterface::POS_I);
*jAxisDirection = calculateCellMainAxisVector(hexCorners, cvf::StructGridInterface::NEG_J, cvf::StructGridInterface::POS_J);
*kAxisDirection = calculateCellMainAxisVector(hexCorners, cvf::StructGridInterface::NEG_K, cvf::StructGridInterface::POS_K);
}
//--------------------------------------------------------------------------------------------------
/// Calculate the main axis vector for one axis in the cell, fron `negativeFace` to `positiveFace`
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RigWellPathIntersectionTools::calculateCellMainAxisVector(const std::array<cvf::Vec3d, 8>& hexCorners,
cvf::StructGridInterface::FaceType negativeFace,
cvf::StructGridInterface::FaceType positiveFace)
{
cvf::ubyte negativeFaceVertexIndices[4];
cvf::StructGridInterface::cellFaceVertexIndices(negativeFace, negativeFaceVertexIndices);
cvf::Vec3d negativeFaceCenter = cvf::GeometryTools::computeFaceCenter(hexCorners[negativeFaceVertexIndices[0]],
hexCorners[negativeFaceVertexIndices[1]],
hexCorners[negativeFaceVertexIndices[2]],
hexCorners[negativeFaceVertexIndices[3]]);
cvf::ubyte positiveFaceVertexIndices[4];
cvf::StructGridInterface::cellFaceVertexIndices(positiveFace, positiveFaceVertexIndices);
cvf::Vec3d positiveFaceCenter = cvf::GeometryTools::computeFaceCenter(hexCorners[positiveFaceVertexIndices[0]],
hexCorners[positiveFaceVertexIndices[1]],
hexCorners[positiveFaceVertexIndices[2]],
hexCorners[positiveFaceVertexIndices[3]]);
return positiveFaceCenter - negativeFaceCenter;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
WellPathCellDirection RigWellPathIntersectionTools::calculateDirectionInCell(const std::array<cvf::Vec3d, 8>& hexCorners, const cvf::Vec3d& startPoint, const cvf::Vec3d& endPoint)
cvf::Vec3d RigWellPathIntersectionTools::calculateLengthInCell(const std::array<cvf::Vec3d, 8>& hexCorners, const cvf::Vec3d& startPoint, const cvf::Vec3d& endPoint)
{
cvf::Vec3d vec = endPoint - startPoint;
cvf::Vec3d iAxisDirection;
cvf::Vec3d jAxisDirection;
cvf::Vec3d kAxisDirection;
cvf::Vec3d iAxisVector;
cvf::Vec3d jAxisVector;
cvf::Vec3d kAxisVector;
calculateCellMainAxisVectors(hexCorners, &iAxisVector, &jAxisVector, &kAxisVector);
cvf::Vec3d iAxisDirection = iAxisVector.getNormalized();
cvf::Vec3d jAxisDirection = jAxisVector.getNormalized();
cvf::Vec3d kAxisDirection = kAxisVector.getNormalized();
RigCellGeometryTools::findCellLocalXYZ(hexCorners, iAxisDirection, jAxisDirection, kAxisDirection);
cvf::Mat3d localCellCoordinateSystem(iAxisDirection.x(), jAxisDirection.x(), kAxisDirection.x(),
iAxisDirection.y(), jAxisDirection.y(), kAxisDirection.y(),
iAxisDirection.z(), jAxisDirection.z(), kAxisDirection.z());
cvf::Vec3d localCellCoordinateVec = vec.getTransformedVector(localCellCoordinateSystem.getInverted());
double iLengthFraction = abs(localCellCoordinateVec.x() / iAxisVector.length());
double jLengthFraction = abs(localCellCoordinateVec.y() / jAxisVector.length());
double kLengthFraction = abs(localCellCoordinateVec.z() / kAxisVector.length());
if (iLengthFraction > jLengthFraction && iLengthFraction > kLengthFraction)
{
WellPathCellDirection direction = POS_I;
if (localCellCoordinateVec.x() < 0)
{
direction = NEG_I;
}
return direction;
}
else if (jLengthFraction > iLengthFraction && jLengthFraction > kLengthFraction)
{
WellPathCellDirection direction = POS_J;
if (localCellCoordinateVec.y() < 0)
{
direction = NEG_J;
}
return direction;
}
else
{
WellPathCellDirection direction = POS_K;
if (localCellCoordinateVec.z() < 0)
{
direction = NEG_K;
}
return direction;
}
return vec.getTransformedVector(localCellCoordinateSystem.getInverted());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
WellPathCellDirection RigWellPathIntersectionTools::calculateDirectionInCell(const RigMainGrid* grid, size_t cellIndex, const cvf::Vec3d& startPoint, const cvf::Vec3d& endPoint)
cvf::Vec3d RigWellPathIntersectionTools::calculateLengthInCell(const RigMainGrid* grid, size_t cellIndex, const cvf::Vec3d& startPoint, const cvf::Vec3d& endPoint)
{
std::array<cvf::Vec3d, 8> hexCorners = getCellHexCorners(grid, cellIndex);
std::array<cvf::Vec3d, 8> hexCorners;
grid->cellCornerVertices(cellIndex, hexCorners.data());
return calculateDirectionInCell(hexCorners, startPoint, endPoint);
return calculateLengthInCell(hexCorners, startPoint, endPoint);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -245,16 +175,16 @@ size_t RigWellPathIntersectionTools::findCellFromCoords(const RigMainGrid* grid,
cvf::BoundingBox bb;
bb.add(coords);
std::vector<size_t> closeCells = findCloseCells(grid, bb);
cvf::Vec3d hexCorners[8];
std::array<cvf::Vec3d, 8> hexCorners;
for (size_t closeCell : closeCells)
{
const RigCell& cell = grid->globalCellArray()[closeCell];
if (cell.isInvalid()) continue;
setHexCorners(cell, nodeCoords, hexCorners);
grid->cellCornerVertices(closeCell, hexCorners.data());
if (RigHexIntersector::isPointInCell(coords, hexCorners))
if (RigHexIntersector::isPointInCell(coords, hexCorners.data()))
{
*foundCell = true;
return closeCell;
@ -265,36 +195,6 @@ size_t RigWellPathIntersectionTools::findCellFromCoords(const RigMainGrid* grid,
return 0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::array<cvf::Vec3d, 8> RigWellPathIntersectionTools::getCellHexCorners(const RigMainGrid* grid, size_t cellIndex)
{
const std::vector<cvf::Vec3d>& nodeCoords = grid->nodes();
std::array<cvf::Vec3d, 8> corners;
const RigCell& cell = grid->globalCellArray()[cellIndex];
setHexCorners(cell, nodeCoords, corners.data());
return corners;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigWellPathIntersectionTools::setHexCorners(const RigCell& cell, const std::vector<cvf::Vec3d>& nodeCoords, cvf::Vec3d* hexCorners)
{
const caf::SizeTArray8& cornerIndices = cell.cornerIndices();
hexCorners[0] = nodeCoords[cornerIndices[0]];
hexCorners[1] = nodeCoords[cornerIndices[1]];
hexCorners[2] = nodeCoords[cornerIndices[2]];
hexCorners[3] = nodeCoords[cornerIndices[3]];
hexCorners[4] = nodeCoords[cornerIndices[4]];
hexCorners[5] = nodeCoords[cornerIndices[5]];
hexCorners[6] = nodeCoords[cornerIndices[6]];
hexCorners[7] = nodeCoords[cornerIndices[7]];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -30,33 +30,21 @@ class RigWellPath;
class RigMainGrid;
class RigEclipseCaseData;
//==================================================================================================
///
//==================================================================================================
enum WellPathCellDirection {
POS_I,
NEG_I,
POS_J,
NEG_J,
POS_K,
NEG_K
};
//==================================================================================================
///
//==================================================================================================
struct WellPathCellIntersectionInfo {
WellPathCellIntersectionInfo(size_t cellIndex, WellPathCellDirection direction, cvf::Vec3d startPoint, cvf::Vec3d endPoint)
WellPathCellIntersectionInfo(size_t cellIndex, cvf::Vec3d startPoint, cvf::Vec3d endPoint, cvf::Vec3d internalCellLengths)
: cellIndex(cellIndex),
direction(direction),
startPoint(startPoint),
endPoint(endPoint)
endPoint(endPoint),
internalCellLengths(internalCellLengths)
{}
size_t cellIndex;
WellPathCellDirection direction;
cvf::Vec3d startPoint;
cvf::Vec3d endPoint;
size_t cellIndex;
cvf::Vec3d startPoint;
cvf::Vec3d endPoint;
cvf::Vec3d internalCellLengths;
};
//==================================================================================================
@ -69,18 +57,12 @@ public:
static std::vector<HexIntersectionInfo> getIntersectedCells(const RigMainGrid* grid, const std::vector<cvf::Vec3d>& coords);
// Calculate direction
static void calculateCellMainAxisVectors(const std::array<cvf::Vec3d, 8>& hexCorners, cvf::Vec3d* iAxisDirection, cvf::Vec3d* jAxisDirection, cvf::Vec3d* kAxisDirection);
static cvf::Vec3d calculateCellMainAxisVector(const std::array<cvf::Vec3d, 8>& hexCorners, cvf::StructGridInterface::FaceType startFace, cvf::StructGridInterface::FaceType endFace);
static WellPathCellDirection calculateDirectionInCell(const std::array<cvf::Vec3d, 8>& hexCorners, const cvf::Vec3d& startPoint, const cvf::Vec3d& endPoint);
static WellPathCellDirection calculateDirectionInCell(const RigMainGrid* grid, size_t cellIndex, const cvf::Vec3d& startPoint, const cvf::Vec3d& endPoint);
static cvf::Vec3d calculateLengthInCell(const std::array<cvf::Vec3d, 8>& hexCorners, const cvf::Vec3d& startPoint, const cvf::Vec3d& endPoint);
static cvf::Vec3d calculateLengthInCell(const RigMainGrid* grid, size_t cellIndex, const cvf::Vec3d& startPoint, const cvf::Vec3d& endPoint);
static std::vector<size_t> findCloseCells(const RigMainGrid* grid, const cvf::BoundingBox& bb);
static size_t findCellFromCoords(const RigMainGrid* caseData, const cvf::Vec3d& coords, bool* foundCell);
static std::array<cvf::Vec3d, 8> getCellHexCorners(const RigMainGrid* grid, size_t cellIndex);
static void setHexCorners(const RigCell& cell, const std::vector<cvf::Vec3d>& nodeCoords, cvf::Vec3d* hexCorners);
private:
static void removeEnteringIntersections(std::vector<HexIntersectionInfo>* intersections);
};

View File

@ -140,7 +140,7 @@ TEST(RigCellGeometryTools, planeHexCellIntersectionTest)
//--------------------------------------------------------------------------------------------------
TEST(RigCellGeometryTools, findCellAverageZTest)
{
cvf::Vec3d hexCorners[8];
std::array<cvf::Vec3d, 8> hexCorners;
hexCorners[0] = cvf::Vec3d(0, 0, 0);
hexCorners[1] = cvf::Vec3d(1, 0, 0);

View File

@ -22,119 +22,3 @@
#include "cvfStructGrid.h"
TEST(RigWellPathIntersectionTools, TestCalculateMainAxisVector)
{
std::array<cvf::Vec3d, 8> hexCorners = {
cvf::Vec3d(0.0, 0.0, 0.0),
cvf::Vec3d(10.0, 0.0, 0.0),
cvf::Vec3d(10.0, 10.0, 0.0),
cvf::Vec3d(0.0, 10.0, 0.0),
cvf::Vec3d(0.0, 0.0, 10.0),
cvf::Vec3d(10.0, 0.0, 10.0),
cvf::Vec3d(10.0, 10.0, 10.0),
cvf::Vec3d(0.0, 10.0, 10.0),
};
cvf::Vec3d iMainAxisVector = RigWellPathIntersectionTools::calculateCellMainAxisVector(hexCorners, cvf::StructGridInterface::NEG_I, cvf::StructGridInterface::POS_I);
EXPECT_EQ(10, iMainAxisVector.x());
EXPECT_EQ(0, iMainAxisVector.y());
EXPECT_EQ(0, iMainAxisVector.z());
cvf::Vec3d jMainAxisVector = RigWellPathIntersectionTools::calculateCellMainAxisVector(hexCorners, cvf::StructGridInterface::NEG_J, cvf::StructGridInterface::POS_J);
EXPECT_EQ(0 , jMainAxisVector.x());
EXPECT_EQ(10, jMainAxisVector.y());
EXPECT_EQ(0, jMainAxisVector.z());
cvf::Vec3d kMainAxisVector = RigWellPathIntersectionTools::calculateCellMainAxisVector(hexCorners, cvf::StructGridInterface::NEG_K, cvf::StructGridInterface::POS_K);
EXPECT_EQ(0, kMainAxisVector.x());
EXPECT_EQ(0, kMainAxisVector.y());
EXPECT_EQ(10, kMainAxisVector.z());
}
TEST(RigWellPathIntersectionTools, TestCalculateMainAxisVectors)
{
std::array<cvf::Vec3d, 8> hexCorners = {
cvf::Vec3d(0.0, 0.0, 0.0),
cvf::Vec3d(10.0, 0.0, 0.0),
cvf::Vec3d(10.0, 10.0, 0.0),
cvf::Vec3d(0.0, 10.0, 0.0),
cvf::Vec3d(0.0, 0.0, 10.0),
cvf::Vec3d(10.0, 0.0, 10.0),
cvf::Vec3d(10.0, 10.0, 10.0),
cvf::Vec3d(0.0, 10.0, 10.0),
};
cvf::Vec3d iMainAxisVector;
cvf::Vec3d jMainAxisVector;
cvf::Vec3d kMainAxisVector;
RigWellPathIntersectionTools::calculateCellMainAxisVectors(hexCorners, &iMainAxisVector, &jMainAxisVector, &kMainAxisVector);
EXPECT_EQ(10, iMainAxisVector.x());
EXPECT_EQ(0, iMainAxisVector.y());
EXPECT_EQ(0, iMainAxisVector.z());
EXPECT_EQ(0 , jMainAxisVector.x());
EXPECT_EQ(10, jMainAxisVector.y());
EXPECT_EQ(0, jMainAxisVector.z());
EXPECT_EQ(0, kMainAxisVector.x());
EXPECT_EQ(0, kMainAxisVector.y());
EXPECT_EQ(10, kMainAxisVector.z());
}
TEST(RigWellPathIntersectionTools, TestCalculateDirectionInCellThroughCellCenters)
{
std::array<cvf::Vec3d, 8> hexCorners = {
cvf::Vec3d(0.0, 0.0, 0.0),
cvf::Vec3d(10.0, 0.0, 0.0),
cvf::Vec3d(10.0, 10.0, 0.0),
cvf::Vec3d(0.0, 10.0, 0.0),
cvf::Vec3d(0.0, 0.0, 10.0),
cvf::Vec3d(10.0, 0.0, 10.0),
cvf::Vec3d(10.0, 10.0, 10.0),
cvf::Vec3d(0.0, 10.0, 10.0),
};
{
cvf::Vec3d startPoint(0, 5, 5);
cvf::Vec3d endPoint(10, 5, 5);
WellPathCellDirection direction = RigWellPathIntersectionTools::calculateDirectionInCell(hexCorners, startPoint, endPoint);
EXPECT_EQ(POS_I, direction);
}
{
cvf::Vec3d startPoint(5, 0, 5);
cvf::Vec3d endPoint(5, 10, 5);
WellPathCellDirection direction = RigWellPathIntersectionTools::calculateDirectionInCell(hexCorners, startPoint, endPoint);
EXPECT_EQ(POS_J, direction);
}
{
cvf::Vec3d startPoint(5, 5, 0);
cvf::Vec3d endPoint(5, 5, 10);
WellPathCellDirection direction = RigWellPathIntersectionTools::calculateDirectionInCell(hexCorners, startPoint, endPoint);
EXPECT_EQ(POS_K, direction);
}
}
TEST(RigWellPathIntersectionTools, TestCalculateJDirectionThroughCells)
{
std::array<cvf::Vec3d, 8> hexCorners = {
cvf::Vec3d(402380, 7.21315e+06, -4219.43),
cvf::Vec3d(402475, 7.21311e+06, -4226.57),
cvf::Vec3d(402510, 7.2132e+06, -4226.75),
cvf::Vec3d(402414, 7.21324e+06, -4222.8),
cvf::Vec3d(402385, 7.21314e+06, -4232.71),
cvf::Vec3d(402480, 7.2131e+06, -4239.88),
cvf::Vec3d(402515, 7.2132e+06, -4239.94),
cvf::Vec3d(402419, 7.21323e+06, -4235.84),
};
cvf::Vec3d startPoint(402428, 7.21323e+06, -4223.35);
cvf::Vec3d endPoint(402399, 7.21314e+06, -4224.48);
WellPathCellDirection direction = RigWellPathIntersectionTools::calculateDirectionInCell(hexCorners, startPoint, endPoint);
EXPECT_EQ(NEG_J, direction);
}

View File

@ -1,7 +1,7 @@
set(RESINSIGHT_MAJOR_VERSION 2017)
set(RESINSIGHT_MINOR_VERSION 05)
set(RESINSIGHT_INCREMENT_VERSION "pre-proto.12")
set(RESINSIGHT_INCREMENT_VERSION "pre-proto.15")
# https://github.com/CRAVA/crava/tree/master/libs/nrlib