diff --git a/ApplicationCode/Application/CMakeLists_files.cmake b/ApplicationCode/Application/CMakeLists_files.cmake index 47cbcb4ec5..9274ba491c 100644 --- a/ApplicationCode/Application/CMakeLists_files.cmake +++ b/ApplicationCode/Application/CMakeLists_files.cmake @@ -8,6 +8,7 @@ set (SOURCE_GROUP_HEADER_FILES ${CEE_CURRENT_LIST_DIR}RiaApplication.h ${CEE_CURRENT_LIST_DIR}RiaDefines.h ${CEE_CURRENT_LIST_DIR}RiaPreferences.h +${CEE_CURRENT_LIST_DIR}RiaPorosityModel.h ) set (SOURCE_GROUP_SOURCE_FILES @@ -15,6 +16,7 @@ ${CEE_CURRENT_LIST_DIR}RiaApplication.cpp ${CEE_CURRENT_LIST_DIR}RiaDefines.cpp ${CEE_CURRENT_LIST_DIR}RiaMain.cpp ${CEE_CURRENT_LIST_DIR}RiaPreferences.cpp +${CEE_CURRENT_LIST_DIR}RiaPorosityModel.cpp ) list(APPEND CODE_HEADER_FILES diff --git a/ApplicationCode/Application/RiaApplication.cpp b/ApplicationCode/Application/RiaApplication.cpp index a1b8ba2a93..ff1d7d7345 100644 --- a/ApplicationCode/Application/RiaApplication.cpp +++ b/ApplicationCode/Application/RiaApplication.cpp @@ -37,7 +37,6 @@ #include "RimCellEdgeColors.h" #include "RimCellRangeFilterCollection.h" #include "RimCommandObject.h" -#include "RiaDefines.h" #include "RimEclipseCaseCollection.h" #include "RimEclipseCellColors.h" #include "RimEclipseFaultColors.h" diff --git a/ApplicationCode/Application/RiaDefines.cpp b/ApplicationCode/Application/RiaDefines.cpp index 378744bf11..c57b04e117 100644 --- a/ApplicationCode/Application/RiaDefines.cpp +++ b/ApplicationCode/Application/RiaDefines.cpp @@ -19,6 +19,7 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RiaDefines.h" + #include "cafAppEnum.h" @@ -36,15 +37,6 @@ namespace caf setDefault(RiaDefines::DYNAMIC_NATIVE); } - template<> - void caf::AppEnum< RiaDefines::PorosityModelType >::setUp() - { - addItem(RiaDefines::MATRIX_MODEL, "MATRIX_MODEL", "Matrix"); - addItem(RiaDefines::FRACTURE_MODEL, "FRACTURE_MODEL", "Fracture"); - - setDefault(RiaDefines::MATRIX_MODEL); - } - template<> void caf::AppEnum< RiaDefines::DepthUnitType >::setUp() { @@ -110,3 +102,211 @@ bool RiaDefines::isPerCellFaceResult(const QString& resultName) return false; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::undefinedResultName() +{ + return "None"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::undefinedGridFaultName() +{ + return "Undefined Grid Faults"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::undefinedGridFaultWithInactiveName() +{ + return "Undefined Grid Faults With Inactive"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::combinedTransmissibilityResultName() +{ + return "TRANXYZ"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::ternarySaturationResultName() +{ + return "TERNARY"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::combinedMultResultName() +{ + return "MULTXYZ"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::riTranXResultName() +{ + return "riTRANX"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::riTranYResultName() +{ + return "riTRANY"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::riTranZResultName() +{ + return "riTRANZ"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::combinedRiTranResultName() +{ + return "riTRANXYZ"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::riMultXResultName() +{ + return "riMULTX"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::riMultYResultName() +{ + return "riMULTY"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::riMultZResultName() +{ + return "riMULTZ"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::combinedRiMultResultName() +{ + return "riMULTXYZ"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::riAreaNormTranXResultName() +{ + return "riTRANXbyArea"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::riAreaNormTranYResultName() +{ + return "riTRANYbyArea"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::riAreaNormTranZResultName() +{ + return "riTRANZbyArea"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::combinedRiAreaNormTranResultName() +{ + return "riTRANXYZbyArea"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::completionTypeResultName() +{ + return "Completion Type"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::mockModelBasic() +{ + return "Result Mock Debug Model Simple"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::mockModelBasicWithResults() +{ + return "Result Mock Debug Model With Results"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::mockModelLargeWithResults() +{ + return "Result Mock Debug Model Large With Results"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::mockModelCustomized() +{ + return "Result Mock Debug Model Customized"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::mockModelBasicInputCase() +{ + return "Input Mock Debug Model Simple"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RiaDefines::minimumDefaultValuePlot() +{ + return -10.0; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RiaDefines::maximumDefaultValuePlot() +{ + return 100.0; +} diff --git a/ApplicationCode/Application/RiaDefines.h b/ApplicationCode/Application/RiaDefines.h index 7884b37087..b06d77a0d2 100644 --- a/ApplicationCode/Application/RiaDefines.h +++ b/ApplicationCode/Application/RiaDefines.h @@ -22,10 +22,8 @@ #include -class RiaDefines +namespace RiaDefines { - -public: enum ResultCatType { DYNAMIC_NATIVE, @@ -37,12 +35,6 @@ public: REMOVED }; - enum PorosityModelType - { - MATRIX_MODEL, - FRACTURE_MODEL - }; - enum CompletionType { WELL_PATH, PERFORATION_INTERVAL, @@ -50,38 +42,38 @@ public: FRACTURE, }; - static bool isPerCellFaceResult(const QString& resultName); + bool isPerCellFaceResult(const QString& resultName); - static QString undefinedResultName() { return "None"; } - static QString undefinedGridFaultName() { return "Undefined Grid Faults"; } - static QString undefinedGridFaultWithInactiveName() { return "Undefined Grid Faults With Inactive"; } - static QString combinedTransmissibilityResultName() { return "TRANXYZ"; } - static QString ternarySaturationResultName() { return "TERNARY"; } - static QString combinedMultResultName() { return "MULTXYZ"; } + QString undefinedResultName(); + QString undefinedGridFaultName(); + QString undefinedGridFaultWithInactiveName(); + QString combinedTransmissibilityResultName(); + QString ternarySaturationResultName(); + QString combinedMultResultName(); - static QString riTranXResultName() { return "riTRANX"; } - static QString riTranYResultName() { return "riTRANY"; } - static QString riTranZResultName() { return "riTRANZ"; } - static QString combinedRiTranResultName() { return "riTRANXYZ"; } + QString riTranXResultName(); + QString riTranYResultName(); + QString riTranZResultName(); + QString combinedRiTranResultName(); - static QString riMultXResultName() { return "riMULTX"; } - static QString riMultYResultName() { return "riMULTY"; } - static QString riMultZResultName() { return "riMULTZ"; } - static QString combinedRiMultResultName() { return "riMULTXYZ"; } + QString riMultXResultName(); + QString riMultYResultName(); + QString riMultZResultName(); + QString combinedRiMultResultName(); - static QString riAreaNormTranXResultName() { return "riTRANXbyArea"; } - static QString riAreaNormTranYResultName() { return "riTRANYbyArea"; } - static QString riAreaNormTranZResultName() { return "riTRANZbyArea"; } - static QString combinedRiAreaNormTranResultName() { return "riTRANXYZbyArea"; } + QString riAreaNormTranXResultName(); + QString riAreaNormTranYResultName(); + QString riAreaNormTranZResultName(); + QString combinedRiAreaNormTranResultName(); - static QString completionTypeResultName() { return "Completion Type"; } + QString completionTypeResultName(); // Mock model text identifiers - static QString mockModelBasic() { return "Result Mock Debug Model Simple"; } - static QString mockModelBasicWithResults() { return "Result Mock Debug Model With Results"; } - static QString mockModelLargeWithResults() { return "Result Mock Debug Model Large With Results"; } - static QString mockModelCustomized() { return "Result Mock Debug Model Customized"; } - static QString mockModelBasicInputCase() { return "Input Mock Debug Model Simple"; } + QString mockModelBasic(); + QString mockModelBasicWithResults(); + QString mockModelLargeWithResults(); + QString mockModelCustomized(); + QString mockModelBasicInputCase(); //Units and conversions @@ -101,7 +93,7 @@ public: PLOT_AXIS_RIGHT }; - static double minimumDefaultValuePlot() { return - 10.0; } - static double maximumDefaultValuePlot() { return 100.0; } + double minimumDefaultValuePlot(); + double maximumDefaultValuePlot(); }; diff --git a/ApplicationCode/Application/RiaPorosityModel.cpp b/ApplicationCode/Application/RiaPorosityModel.cpp new file mode 100644 index 0000000000..4ca08690ec --- /dev/null +++ b/ApplicationCode/Application/RiaPorosityModel.cpp @@ -0,0 +1,34 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiaPorosityModel.h" + +#include "cafAppEnum.h" + + +namespace caf +{ + template<> + void caf::AppEnum< RiaDefines::PorosityModelType >::setUp() + { + addItem(RiaDefines::MATRIX_MODEL, "MATRIX_MODEL", "Matrix"); + addItem(RiaDefines::FRACTURE_MODEL, "FRACTURE_MODEL", "Fracture"); + + setDefault(RiaDefines::MATRIX_MODEL); + } +} diff --git a/ApplicationCode/Application/RiaPorosityModel.h b/ApplicationCode/Application/RiaPorosityModel.h new file mode 100644 index 0000000000..1ad3a4a1c3 --- /dev/null +++ b/ApplicationCode/Application/RiaPorosityModel.h @@ -0,0 +1,31 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +namespace RiaDefines +{ + enum PorosityModelType + { + MATRIX_MODEL, + FRACTURE_MODEL + }; +}; diff --git a/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp b/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp index c19f05bf7b..4e0a4517a8 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicFishbonesTransmissibilityCalculationFeatureImp.cpp @@ -18,19 +18,21 @@ #include "RicFishbonesTransmissibilityCalculationFeatureImp.h" -#include "RigEclipseCaseData.h" #include "RicExportCompletionDataSettingsUi.h" #include "RicWellPathExportCompletionDataFeature.h" -#include "RimWellPath.h" -#include "RigWellPath.h" -#include "RimFishboneWellPath.h" -#include "RimFishbonesCollection.h" + #include "RigActiveCellInfo.h" -#include "RigMainGrid.h" -#include "RimFishbonesMultipleSubs.h" -#include "RimFishboneWellPathCollection.h" -#include "RimWellPathCompletions.h" #include "RigCompletionData.h" +#include "RigEclipseCaseData.h" +#include "RigMainGrid.h" +#include "RigWellPath.h" + +#include "RimFishboneWellPath.h" +#include "RimFishboneWellPathCollection.h" +#include "RimFishbonesCollection.h" +#include "RimFishbonesMultipleSubs.h" +#include "RimWellPath.h" +#include "RimWellPathCompletions.h" //-------------------------------------------------------------------------------------------------- /// @@ -86,7 +88,7 @@ std::vector RicFishbonesTransmissibilityCalculationFeatureImp std::vector completionData; RigMainGrid* grid = settings.caseToApply->eclipseCaseData()->mainGrid(); - const RigActiveCellInfo* activeCellInfo = settings.caseToApply->eclipseCaseData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS); + const RigActiveCellInfo* activeCellInfo = settings.caseToApply->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL); for (auto cellAndWellBoreParts : wellBorePartsInCells) { diff --git a/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp b/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp index 610a08809c..74ff997564 100644 --- a/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp +++ b/ApplicationCode/Commands/CompletionCommands/RicWellPathExportCompletionDataFeature.cpp @@ -590,7 +590,7 @@ void RicWellPathExportCompletionDataFeature::generateCompdatTable(RifEclipseData RifEclipseOutputTableColumn("K2"), RifEclipseOutputTableColumn("Status"), RifEclipseOutputTableColumn("SAT"), - RifEclipseOutputTableColumn("TR", RifEclipseOutputTableDoubleFormatting(RifEclipseOutputTableDoubleFormat::SCIENTIFIC)), + RifEclipseOutputTableColumn("TR", RifEclipseOutputTableDoubleFormatting(RifEclipseOutputTableDoubleFormat::RIF_SCIENTIFIC)), RifEclipseOutputTableColumn("DIAM"), RifEclipseOutputTableColumn("KH"), RifEclipseOutputTableColumn("S"), @@ -703,7 +703,7 @@ std::vector RicWellPathExportCompletionDataFeature::generateP RiaEclipseUnitTools::UnitSystem unitSystem = settings.caseToApply->eclipseCaseData()->unitsType(); std::vector completionData; - const RigActiveCellInfo* activeCellInfo = settings.caseToApply->eclipseCaseData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS); + const RigActiveCellInfo* activeCellInfo = settings.caseToApply->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL); for (const RimPerforationInterval* interval : wellPath->perforationIntervalCollection()->perforations()) @@ -934,12 +934,12 @@ CellDirection RicWellPathExportCompletionDataFeature::calculateDirectionInCell(R { RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData(); - eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "DX"); - cvf::ref dxAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "DX"); - eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "DY"); - cvf::ref dyAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "DY"); - eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "DZ"); - cvf::ref dzAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "DZ"); + eclipseCase->results(RiaDefines::MATRIX_MODEL)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "DX"); + cvf::ref dxAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RiaDefines::MATRIX_MODEL, 0, "DX"); + eclipseCase->results(RiaDefines::MATRIX_MODEL)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "DY"); + cvf::ref dyAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RiaDefines::MATRIX_MODEL, 0, "DY"); + eclipseCase->results(RiaDefines::MATRIX_MODEL)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "DZ"); + cvf::ref dzAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RiaDefines::MATRIX_MODEL, 0, "DZ"); double xLengthFraction = abs(lengthsInCell.x() / dxAccessObject->cellScalarGlobIdx(cellIndex)); double yLengthFraction = abs(lengthsInCell.y() / dyAccessObject->cellScalarGlobIdx(cellIndex)); @@ -973,19 +973,19 @@ double RicWellPathExportCompletionDataFeature::calculateTransmissibility(RimEcli { RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData(); - eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "DX"); - cvf::ref dxAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "DX"); - eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "DY"); - cvf::ref dyAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "DY"); - eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "DZ"); - cvf::ref dzAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "DZ"); + eclipseCase->results(RiaDefines::MATRIX_MODEL)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "DX"); + cvf::ref dxAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RiaDefines::MATRIX_MODEL, 0, "DX"); + eclipseCase->results(RiaDefines::MATRIX_MODEL)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "DY"); + cvf::ref dyAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RiaDefines::MATRIX_MODEL, 0, "DY"); + eclipseCase->results(RiaDefines::MATRIX_MODEL)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "DZ"); + cvf::ref dzAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RiaDefines::MATRIX_MODEL, 0, "DZ"); - eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PERMX"); - cvf::ref permxAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "PERMX"); - eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PERMY"); - cvf::ref permyAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "PERMY"); - eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PERMZ"); - cvf::ref permzAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "PERMZ"); + eclipseCase->results(RiaDefines::MATRIX_MODEL)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PERMX"); + cvf::ref permxAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RiaDefines::MATRIX_MODEL, 0, "PERMX"); + eclipseCase->results(RiaDefines::MATRIX_MODEL)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PERMY"); + cvf::ref permyAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RiaDefines::MATRIX_MODEL, 0, "PERMY"); + eclipseCase->results(RiaDefines::MATRIX_MODEL)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PERMZ"); + cvf::ref permzAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RiaDefines::MATRIX_MODEL, 0, "PERMZ"); double dx = dxAccessObject->cellScalarGlobIdx(cellIndex); double dy = dyAccessObject->cellScalarGlobIdx(cellIndex); @@ -1022,19 +1022,19 @@ double RicWellPathExportCompletionDataFeature::calculateTransmissibilityAsEclips { RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData(); - eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "DX"); - cvf::ref dxAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "DX"); - eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "DY"); - cvf::ref dyAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "DY"); - eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "DZ"); - cvf::ref dzAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "DZ"); + eclipseCase->results(RiaDefines::MATRIX_MODEL)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "DX"); + cvf::ref dxAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RiaDefines::MATRIX_MODEL, 0, "DX"); + eclipseCase->results(RiaDefines::MATRIX_MODEL)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "DY"); + cvf::ref dyAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RiaDefines::MATRIX_MODEL, 0, "DY"); + eclipseCase->results(RiaDefines::MATRIX_MODEL)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "DZ"); + cvf::ref dzAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RiaDefines::MATRIX_MODEL, 0, "DZ"); - eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PERMX"); - cvf::ref permxAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "PERMX"); - eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PERMY"); - cvf::ref permyAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "PERMY"); - eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PERMZ"); - cvf::ref permzAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RifReaderInterface::MATRIX_RESULTS, 0, "PERMZ"); + eclipseCase->results(RiaDefines::MATRIX_MODEL)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PERMX"); + cvf::ref permxAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RiaDefines::MATRIX_MODEL, 0, "PERMX"); + eclipseCase->results(RiaDefines::MATRIX_MODEL)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PERMY"); + cvf::ref permyAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RiaDefines::MATRIX_MODEL, 0, "PERMY"); + eclipseCase->results(RiaDefines::MATRIX_MODEL)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PERMZ"); + cvf::ref permzAccessObject = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RiaDefines::MATRIX_MODEL, 0, "PERMZ"); double dx = dxAccessObject->cellScalarGlobIdx(cellIndex); double dy = dyAccessObject->cellScalarGlobIdx(cellIndex); diff --git a/ApplicationCode/Commands/ExportCommands/RicCellRangeUi.cpp b/ApplicationCode/Commands/ExportCommands/RicCellRangeUi.cpp index fd223e3061..3c74619381 100644 --- a/ApplicationCode/Commands/ExportCommands/RicCellRangeUi.cpp +++ b/ApplicationCode/Commands/ExportCommands/RicCellRangeUi.cpp @@ -260,7 +260,7 @@ RigActiveCellInfo* RicCellRangeUi::activeCellInfo() const RimEclipseCase* rimEclipeCase = dynamic_cast(m_case()); if (rimEclipeCase && rimEclipeCase->eclipseCaseData()) { - return rimEclipeCase->eclipseCaseData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS); + return rimEclipeCase->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL); } return nullptr; diff --git a/ApplicationCode/Commands/ExportCommands/RicExportFaultsFeature.cpp b/ApplicationCode/Commands/ExportCommands/RicExportFaultsFeature.cpp index 80eef8e469..c179a8de3e 100644 --- a/ApplicationCode/Commands/ExportCommands/RicExportFaultsFeature.cpp +++ b/ApplicationCode/Commands/ExportCommands/RicExportFaultsFeature.cpp @@ -25,7 +25,6 @@ #include "RigFault.h" #include "RigMainGrid.h" -#include "RiaDefines.h" #include "RimEclipseCase.h" #include "RimFault.h" diff --git a/ApplicationCode/FileInterface/RifEclipseDataTableFormatter.cpp b/ApplicationCode/FileInterface/RifEclipseDataTableFormatter.cpp index 01fb6851b8..4ed1a6a699 100644 --- a/ApplicationCode/FileInterface/RifEclipseDataTableFormatter.cpp +++ b/ApplicationCode/FileInterface/RifEclipseDataTableFormatter.cpp @@ -248,9 +248,9 @@ QString RifEclipseDataTableFormatter::format(double num, RifEclipseOutputTableDo { switch (doubleFormat.format) { - case RifEclipseOutputTableDoubleFormat::FLOAT: + case RifEclipseOutputTableDoubleFormat::RIF_FLOAT: return QString("%1").arg(num, 0, 'f', doubleFormat.width); - case RifEclipseOutputTableDoubleFormat::SCIENTIFIC: + case RifEclipseOutputTableDoubleFormat::RIF_SCIENTIFIC: return QString("%1").arg(num, 0, 'E'); default: return QString("%1"); diff --git a/ApplicationCode/FileInterface/RifEclipseDataTableFormatter.h b/ApplicationCode/FileInterface/RifEclipseDataTableFormatter.h index fdb309eb1a..dab0e8fd8a 100644 --- a/ApplicationCode/FileInterface/RifEclipseDataTableFormatter.h +++ b/ApplicationCode/FileInterface/RifEclipseDataTableFormatter.h @@ -46,8 +46,8 @@ enum RifEclipseOutputTableAlignment //================================================================================================== enum RifEclipseOutputTableDoubleFormat { - SCIENTIFIC, - FLOAT, + RIF_SCIENTIFIC, + RIF_FLOAT, }; //================================================================================================== @@ -64,7 +64,7 @@ struct RifEclipseOutputTableLine //================================================================================================== struct RifEclipseOutputTableDoubleFormatting { - RifEclipseOutputTableDoubleFormatting(RifEclipseOutputTableDoubleFormat format = FLOAT, int width = 5) + RifEclipseOutputTableDoubleFormatting(RifEclipseOutputTableDoubleFormat format = RIF_FLOAT, int width = 5) : format(format), width(width) {} diff --git a/ApplicationCode/FileInterface/RifEclipseInputFileTools.cpp b/ApplicationCode/FileInterface/RifEclipseInputFileTools.cpp index eb8f70a98c..2f12dbf6a7 100644 --- a/ApplicationCode/FileInterface/RifEclipseInputFileTools.cpp +++ b/ApplicationCode/FileInterface/RifEclipseInputFileTools.cpp @@ -231,7 +231,7 @@ std::map RifEclipseInputFileTools::readProperties(const QStrin ecl_kw_type* eclipseKeywordData = ecl_kw_fscanf_alloc_current_grdecl__(gridFilePointer, false, ecl_type_create_from_type(ECL_FLOAT_TYPE)); if (eclipseKeywordData) { - QString newResultName = caseData->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(fileKeywords[i].keyword); + QString newResultName = caseData->results(RiaDefines::MATRIX_MODEL)->makeResultNameUnique(fileKeywords[i].keyword); if (readDataFromKeyword(eclipseKeywordData, caseData, newResultName)) { newResults[newResultName] = fileKeywords[i].keyword; @@ -290,7 +290,7 @@ bool RifEclipseInputFileTools::readDataFromKeyword(ecl_kw_type* eclipseKeywordDa { mathingItemCount = true; } - if (itemCount == caseData->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->reservoirActiveCellCount()) + if (itemCount == caseData->activeCellInfo(RiaDefines::MATRIX_MODEL)->reservoirActiveCellCount()) { mathingItemCount = true; } @@ -301,7 +301,7 @@ bool RifEclipseInputFileTools::readDataFromKeyword(ecl_kw_type* eclipseKeywordDa size_t resultIndex = RifEclipseInputFileTools::findOrCreateResult(resultName, caseData); if (resultIndex == cvf::UNDEFINED_SIZE_T) return false; - std::vector< std::vector >& newPropertyData = caseData->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex); + std::vector< std::vector >& newPropertyData = caseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(resultIndex); newPropertyData.push_back(std::vector()); newPropertyData[0].resize(ecl_kw_get_size(eclipseKeywordData), HUGE_VAL); ecl_kw_get_data_as_double(eclipseKeywordData, newPropertyData[0].data()); @@ -446,7 +446,7 @@ bool RifEclipseInputFileTools::writePropertyToTextFile(const QString& fileName, { CVF_ASSERT(eclipseCase); - size_t resultIndex = eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->findScalarResultIndex(resultName); + size_t resultIndex = eclipseCase->results(RiaDefines::MATRIX_MODEL)->findScalarResultIndex(resultName); if (resultIndex == cvf::UNDEFINED_SIZE_T) { return false; @@ -458,7 +458,7 @@ bool RifEclipseInputFileTools::writePropertyToTextFile(const QString& fileName, return false; } - std::vector< std::vector >& resultData = eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex); + std::vector< std::vector >& resultData = eclipseCase->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(resultIndex); if (resultData.size() == 0) { return false; @@ -717,10 +717,10 @@ qint64 RifEclipseInputFileTools::findKeyword(const QString& keyword, QFile& file //-------------------------------------------------------------------------------------------------- size_t RifEclipseInputFileTools::findOrCreateResult(const QString& newResultName, RigEclipseCaseData* reservoir) { - size_t resultIndex = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->findScalarResultIndex(newResultName); + size_t resultIndex = reservoir->results(RiaDefines::MATRIX_MODEL)->findScalarResultIndex(newResultName); if (resultIndex == cvf::UNDEFINED_SIZE_T) { - resultIndex = reservoir->results(RifReaderInterface::MATRIX_RESULTS)->addEmptyScalarResult(RiaDefines::INPUT_PROPERTY, newResultName, false); + resultIndex = reservoir->results(RiaDefines::MATRIX_MODEL)->addEmptyScalarResult(RiaDefines::INPUT_PROPERTY, newResultName, false); } return resultIndex; diff --git a/ApplicationCode/FileInterface/RifReaderEclipseInput.h b/ApplicationCode/FileInterface/RifReaderEclipseInput.h index 4a608885fb..cb192ba496 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseInput.h +++ b/ApplicationCode/FileInterface/RifReaderEclipseInput.h @@ -38,6 +38,6 @@ public: virtual void close() {} - virtual bool staticResult(const QString& result, PorosityModelResultType matrixOrFracture, std::vector* values ) { return false; } - virtual bool dynamicResult(const QString& result, PorosityModelResultType matrixOrFracture, size_t stepIndex, std::vector* values ) { return false; } + virtual bool staticResult(const QString& result, RiaDefines::PorosityModelType matrixOrFracture, std::vector* values ) { return false; } + virtual bool dynamicResult(const QString& result, RiaDefines::PorosityModelType matrixOrFracture, size_t stepIndex, std::vector* values ) { return false; } }; diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp index d9bd2fe15a..06c5880ad0 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp @@ -30,6 +30,7 @@ #include "RigEclipseCaseData.h" #include "RigMainGrid.h" #include "RigSingleWellResultsData.h" +#include "RigEclipseResultInfo.h" #include "cafProgressInfo.h" @@ -194,8 +195,6 @@ RifReaderEclipseOutput::RifReaderEclipseOutput() m_fileName.clear(); m_filesWithSameBaseName.clear(); - m_timeSteps.clear(); - m_eclipseCase = NULL; m_ecl_init_file = NULL; @@ -243,8 +242,8 @@ bool RifReaderEclipseOutput::transferGeometry(const ecl_grid_type* mainEclGrid, return false; } - RigActiveCellInfo* activeCellInfo = eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS); - RigActiveCellInfo* fractureActiveCellInfo = eclipseCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS); + RigActiveCellInfo* activeCellInfo = eclipseCase->activeCellInfo(RiaDefines::MATRIX_MODEL); + RigActiveCellInfo* fractureActiveCellInfo = eclipseCase->activeCellInfo(RiaDefines::FRACTURE_MODEL); CVF_ASSERT(activeCellInfo && fractureActiveCellInfo); @@ -581,8 +580,8 @@ bool RifReaderEclipseOutput::readActiveCellInfo() return false; } - RigActiveCellInfo* activeCellInfo = m_eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS); - RigActiveCellInfo* fractureActiveCellInfo = m_eclipseCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS); + RigActiveCellInfo* activeCellInfo = m_eclipseCase->activeCellInfo(RiaDefines::MATRIX_MODEL); + RigActiveCellInfo* fractureActiveCellInfo = m_eclipseCase->activeCellInfo(RiaDefines::FRACTURE_MODEL); activeCellInfo->setReservoirCellCount(reservoirCellCount); fractureActiveCellInfo->setReservoirCellCount(reservoirCellCount); @@ -645,8 +644,10 @@ void RifReaderEclipseOutput::buildMetaData() progInfo.setNextProgressIncrement(m_filesWithSameBaseName.size()); - RigCaseCellResultsData* matrixModelResults = m_eclipseCase->results(RifReaderInterface::MATRIX_RESULTS); - RigCaseCellResultsData* fractureModelResults = m_eclipseCase->results(RifReaderInterface::FRACTURE_RESULTS); + RigCaseCellResultsData* matrixModelResults = m_eclipseCase->results(RiaDefines::MATRIX_MODEL); + RigCaseCellResultsData* fractureModelResults = m_eclipseCase->results(RiaDefines::FRACTURE_MODEL); + + std::vector timeStepInfos; // Create access object for dynamic results m_dynamicResultsAccess = createDynamicResultsAccess(); @@ -656,9 +657,7 @@ void RifReaderEclipseOutput::buildMetaData() progInfo.incrementProgress(); - // Get time steps - m_dynamicResultsAccess->timeSteps(&m_timeSteps, &m_daysSinceSimulationStart); - std::vector reportNumbers = m_dynamicResultsAccess->reportNumbers(); + timeStepInfos = createFilteredTimeStepInfos(); QStringList resultNames; std::vector resultNamesDataItemCounts; @@ -666,27 +665,27 @@ void RifReaderEclipseOutput::buildMetaData() { QStringList matrixResultNames = validKeywordsForPorosityModel(resultNames, resultNamesDataItemCounts, - m_eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS), - m_eclipseCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS), - RifReaderInterface::MATRIX_RESULTS, m_dynamicResultsAccess->timeStepCount()); + m_eclipseCase->activeCellInfo(RiaDefines::MATRIX_MODEL), + m_eclipseCase->activeCellInfo(RiaDefines::FRACTURE_MODEL), + RiaDefines::MATRIX_MODEL, m_dynamicResultsAccess->timeStepCount()); for (int i = 0; i < matrixResultNames.size(); ++i) { size_t resIndex = matrixModelResults->addEmptyScalarResult(RiaDefines::DYNAMIC_NATIVE, matrixResultNames[i], false); - matrixModelResults->setTimeStepDates(resIndex, m_timeSteps, m_daysSinceSimulationStart, reportNumbers); + matrixModelResults->setTimeStepInfos(resIndex, timeStepInfos); } } { QStringList fractureResultNames = validKeywordsForPorosityModel(resultNames, resultNamesDataItemCounts, - m_eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS), - m_eclipseCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS), - RifReaderInterface::FRACTURE_RESULTS, m_dynamicResultsAccess->timeStepCount()); + m_eclipseCase->activeCellInfo(RiaDefines::MATRIX_MODEL), + m_eclipseCase->activeCellInfo(RiaDefines::FRACTURE_MODEL), + RiaDefines::FRACTURE_MODEL, m_dynamicResultsAccess->timeStepCount()); for (int i = 0; i < fractureResultNames.size(); ++i) { size_t resIndex = fractureModelResults->addEmptyScalarResult(RiaDefines::DYNAMIC_NATIVE, fractureResultNames[i], false); - fractureModelResults->setTimeStepDates(resIndex, m_timeSteps, m_daysSinceSimulationStart, reportNumbers); + fractureModelResults->setTimeStepInfos(resIndex, timeStepInfos); } } @@ -722,36 +721,17 @@ void RifReaderEclipseOutput::buildMetaData() RifEclipseOutputFileTools::findKeywordsAndItemCount(filesUsedToFindAvailableKeywords, &resultNames, &resultNamesDataItemCounts); - std::vector staticDate; - std::vector staticDay; - std::vector staticReportNumber; + std::vector staticTimeStepInfo; + if (!timeStepInfos.empty()) { - if ( m_timeSteps.size() > 0 ) - { - staticDate.push_back(m_timeSteps.front()); - } - if (m_daysSinceSimulationStart.size() > 0) - { - staticDay.push_back(m_daysSinceSimulationStart.front()); - } - - std::vector reportNumbers; - if (m_dynamicResultsAccess.notNull()) - { - reportNumbers = m_dynamicResultsAccess->reportNumbers(); - } - - if ( reportNumbers.size() > 0 ) - { - staticReportNumber.push_back(reportNumbers.front()); - } + staticTimeStepInfo.push_back(timeStepInfos.front()); } { QStringList matrixResultNames = validKeywordsForPorosityModel(resultNames, resultNamesDataItemCounts, - m_eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS), - m_eclipseCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS), - RifReaderInterface::MATRIX_RESULTS, 1); + m_eclipseCase->activeCellInfo(RiaDefines::MATRIX_MODEL), + m_eclipseCase->activeCellInfo(RiaDefines::FRACTURE_MODEL), + RiaDefines::MATRIX_MODEL, 1); // Add ACTNUM matrixResultNames += "ACTNUM"; @@ -759,22 +739,22 @@ void RifReaderEclipseOutput::buildMetaData() for (int i = 0; i < matrixResultNames.size(); ++i) { size_t resIndex = matrixModelResults->addEmptyScalarResult(RiaDefines::STATIC_NATIVE, matrixResultNames[i], false); - matrixModelResults->setTimeStepDates(resIndex, staticDate, staticDay, staticReportNumber); + matrixModelResults->setTimeStepInfos(resIndex, staticTimeStepInfo); } } { QStringList fractureResultNames = validKeywordsForPorosityModel(resultNames, resultNamesDataItemCounts, - m_eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS), - m_eclipseCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS), - RifReaderInterface::FRACTURE_RESULTS, 1); + m_eclipseCase->activeCellInfo(RiaDefines::MATRIX_MODEL), + m_eclipseCase->activeCellInfo(RiaDefines::FRACTURE_MODEL), + RiaDefines::FRACTURE_MODEL, 1); // Add ACTNUM fractureResultNames += "ACTNUM"; for (int i = 0; i < fractureResultNames.size(); ++i) { size_t resIndex = fractureModelResults->addEmptyScalarResult(RiaDefines::STATIC_NATIVE, fractureResultNames[i], false); - fractureModelResults->setTimeStepDates(resIndex, staticDate, staticDay, staticReportNumber); + fractureModelResults->setTimeStepInfos(resIndex, staticTimeStepInfo); } } } @@ -811,7 +791,7 @@ RifEclipseRestartDataAccess* RifReaderEclipseOutput::createDynamicResultsAccess( //-------------------------------------------------------------------------------------------------- /// Get all values of a given static result as doubles //-------------------------------------------------------------------------------------------------- -bool RifReaderEclipseOutput::staticResult(const QString& result, PorosityModelResultType matrixOrFracture, std::vector* values) +bool RifReaderEclipseOutput::staticResult(const QString& result, RiaDefines::PorosityModelType matrixOrFracture, std::vector* values) { CVF_ASSERT(values); @@ -847,7 +827,7 @@ bool RifReaderEclipseOutput::staticResult(const QString& result, PorosityModelRe //-------------------------------------------------------------------------------------------------- /// Get dynamic result at given step index. Will concatenate values for the main grid and all sub grids. //-------------------------------------------------------------------------------------------------- -bool RifReaderEclipseOutput::dynamicResult(const QString& result, PorosityModelResultType matrixOrFracture, size_t stepIndex, std::vector* values) +bool RifReaderEclipseOutput::dynamicResult(const QString& result, RiaDefines::PorosityModelType matrixOrFracture, size_t stepIndex, std::vector* values) { if (m_dynamicResultsAccess.isNull()) { @@ -856,8 +836,10 @@ bool RifReaderEclipseOutput::dynamicResult(const QString& result, PorosityModelR if (m_dynamicResultsAccess.notNull()) { + size_t indexOnFile = timeStepIndexOnFile(stepIndex); + std::vector fileValues; - if (!m_dynamicResultsAccess->results(result, stepIndex, m_eclipseCase->mainGrid()->gridCount(), &fileValues)) + if (!m_dynamicResultsAccess->results(result, indexOnFile, m_eclipseCase->mainGrid()->gridCount(), &fileValues)) { return false; } @@ -1655,7 +1637,16 @@ void RifReaderEclipseOutput::readWellCells(const ecl_grid_type* mainEclGrid, boo } - wellResults->computeMappingFromResultTimeIndicesToWellTimeIndices(m_timeSteps); + std::vector filteredTimeSteps; + { + std::vector filteredTimeStepInfos = createFilteredTimeStepInfos(); + for (auto a : filteredTimeStepInfos) + { + filteredTimeSteps.push_back(a.m_date); + } + } + + wellResults->computeMappingFromResultTimeIndicesToWellTimeIndices(filteredTimeSteps); wells.push_back(wellResults.p()); @@ -1675,7 +1666,7 @@ QStringList RifReaderEclipseOutput::validKeywordsForPorosityModel(const QStringL const std::vector& keywordDataItemCounts, const RigActiveCellInfo* matrixActiveCellInfo, const RigActiveCellInfo* fractureActiveCellInfo, - PorosityModelResultType porosityModel, + RiaDefines::PorosityModelType porosityModel, size_t timeStepCount) const { CVF_ASSERT(matrixActiveCellInfo); @@ -1685,7 +1676,7 @@ QStringList RifReaderEclipseOutput::validKeywordsForPorosityModel(const QStringL return QStringList(); } - if (porosityModel == RifReaderInterface::FRACTURE_RESULTS) + if (porosityModel == RiaDefines::FRACTURE_MODEL) { if (fractureActiveCellInfo->reservoirActiveCellCount() == 0) { @@ -1721,14 +1712,14 @@ QStringList RifReaderEclipseOutput::validKeywordsForPorosityModel(const QStringL size_t sumFractureMatrixActiveCellCount = matrixActiveCellInfo->reservoirActiveCellCount() + fractureActiveCellInfo->reservoirActiveCellCount(); size_t timeStepsMatrixAndFractureRest = keywordDataItemCount % sumFractureMatrixActiveCellCount; - if (porosityModel == RifReaderInterface::MATRIX_RESULTS && timeStepsMatrixRest == 0) + if (porosityModel == RiaDefines::MATRIX_MODEL && timeStepsMatrixRest == 0) { if (keywordDataItemCount <= timeStepCount * std::max(matrixActiveCellInfo->reservoirActiveCellCount(), sumFractureMatrixActiveCellCount)) { validKeyword = true; } } - else if (porosityModel == RifReaderInterface::FRACTURE_RESULTS && fractureActiveCellInfo->reservoirActiveCellCount() > 0 && timeStepsFractureRest == 0) + else if (porosityModel == RiaDefines::FRACTURE_MODEL && fractureActiveCellInfo->reservoirActiveCellCount() > 0 && timeStepsFractureRest == 0) { if (keywordDataItemCount <= timeStepCount * std::max(fractureActiveCellInfo->reservoirActiveCellCount(), sumFractureMatrixActiveCellCount)) { @@ -1774,19 +1765,47 @@ QStringList RifReaderEclipseOutput::validKeywordsForPorosityModel(const QStringL //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RifReaderEclipseOutput::extractResultValuesBasedOnPorosityModel(PorosityModelResultType matrixOrFracture, std::vector* destinationResultValues, const std::vector& sourceResultValues) +std::vector RifReaderEclipseOutput::createFilteredTimeStepInfos() +{ + std::vector timeStepInfos; + + if (m_dynamicResultsAccess.notNull()) + { + std::vector timeStepsOnFile; + std::vector daysSinceSimulationStartOnFile; + std::vector reportNumbersOnFile; + + m_dynamicResultsAccess->timeSteps(&timeStepsOnFile, &daysSinceSimulationStartOnFile); + reportNumbersOnFile = m_dynamicResultsAccess->reportNumbers(); + + for (size_t i = 0; i < timeStepsOnFile.size(); i++) + { + if (this->isTimeStepIncludedByFilter(i)) + { + timeStepInfos.push_back(RigEclipseTimeStepInfo(timeStepsOnFile[i], reportNumbersOnFile[i], daysSinceSimulationStartOnFile[i])); + } + } + } + + return timeStepInfos; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifReaderEclipseOutput::extractResultValuesBasedOnPorosityModel(RiaDefines::PorosityModelType matrixOrFracture, std::vector* destinationResultValues, const std::vector& sourceResultValues) { if (sourceResultValues.size() == 0) return; - RigActiveCellInfo* fracActCellInfo = m_eclipseCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS); + RigActiveCellInfo* fracActCellInfo = m_eclipseCase->activeCellInfo(RiaDefines::FRACTURE_MODEL); - if (matrixOrFracture == RifReaderInterface::MATRIX_RESULTS && fracActCellInfo->reservoirActiveCellCount() == 0) + if (matrixOrFracture == RiaDefines::MATRIX_MODEL && fracActCellInfo->reservoirActiveCellCount() == 0) { destinationResultValues->insert(destinationResultValues->end(), sourceResultValues.begin(), sourceResultValues.end()); } else { - RigActiveCellInfo* actCellInfo = m_eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS); + RigActiveCellInfo* actCellInfo = m_eclipseCase->activeCellInfo(RiaDefines::MATRIX_MODEL); size_t sourceStartPosition = 0; @@ -1798,7 +1817,7 @@ void RifReaderEclipseOutput::extractResultValuesBasedOnPorosityModel(PorosityMod actCellInfo->gridActiveCellCounts(i, matrixActiveCellCount); fracActCellInfo->gridActiveCellCounts(i, fractureActiveCellCount); - if (matrixOrFracture == RifReaderInterface::MATRIX_RESULTS) + if (matrixOrFracture == RiaDefines::MATRIX_MODEL) { destinationResultValues->insert(destinationResultValues->end(), sourceResultValues.begin() + sourceStartPosition, @@ -1833,14 +1852,6 @@ void RifReaderEclipseOutput::openInitFile() } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector RifReaderEclipseOutput::timeSteps() -{ - return m_timeSteps; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.h b/ApplicationCode/FileInterface/RifReaderEclipseOutput.h index 55f0ec81ca..9f22e99093 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.h +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.h @@ -24,15 +24,13 @@ #include "cvfCollection.h" -#include -#include - class RifEclipseOutputFileTools; class RifEclipseRestartDataAccess; class RigGridBase; class RigMainGrid; class RigActiveCellInfo; class RigFault; +class RigEclipseTimeStepInfo; struct RigWellResultPoint; @@ -56,8 +54,8 @@ public: virtual bool openAndReadActiveCellData(const QString& fileName, const std::vector& mainCaseTimeSteps, RigEclipseCaseData* eclipseCase); void close(); - bool staticResult(const QString& result, PorosityModelResultType matrixOrFracture, std::vector* values); - bool dynamicResult(const QString& result, PorosityModelResultType matrixOrFracture, size_t stepIndex, std::vector* values); + bool staticResult(const QString& result, RiaDefines::PorosityModelType matrixOrFracture, std::vector* values); + bool dynamicResult(const QString& result, RiaDefines::PorosityModelType matrixOrFracture, size_t stepIndex, std::vector* values); static bool transferGeometry(const ecl_grid_type* mainEclGrid, RigEclipseCaseData* eclipseCase); static void transferCoarseningInfo(const ecl_grid_type* eclGrid, RigGridBase* grid); @@ -73,28 +71,24 @@ private: void importFaults(const QStringList& fileSet, cvf::Collection* faults); - void openInitFile(); - bool openDynamicAccess(); - void extractResultValuesBasedOnPorosityModel(PorosityModelResultType matrixOrFracture, std::vector* values, const std::vector& fileValues); + void extractResultValuesBasedOnPorosityModel(RiaDefines::PorosityModelType matrixOrFracture, std::vector* values, const std::vector& fileValues); void transferNNCData( const ecl_grid_type * mainEclGrid , const ecl_file_type * init_file, RigMainGrid * mainGrid); RifEclipseRestartDataAccess* createDynamicResultsAccess(); - QStringList validKeywordsForPorosityModel(const QStringList& keywords, const std::vector& keywordDataItemCounts, const RigActiveCellInfo* activeCellInfo, const RigActiveCellInfo* fractureActiveCellInfo, PorosityModelResultType matrixOrFracture, size_t timeStepCount) const; + QStringList validKeywordsForPorosityModel(const QStringList& keywords, const std::vector& keywordDataItemCounts, const RigActiveCellInfo* activeCellInfo, const RigActiveCellInfo* fractureActiveCellInfo, RiaDefines::PorosityModelType matrixOrFracture, size_t timeStepCount) const; + + std::vector createFilteredTimeStepInfos(); - virtual std::vector timeSteps(); private: - QString m_fileName; // Name of file used to start accessing Eclipse output files - QStringList m_filesWithSameBaseName; // Set of files in filename's path with same base name as filename + QString m_fileName; // Name of file used to start accessing Eclipse output files + QStringList m_filesWithSameBaseName; // Set of files in filename's path with same base name as filename - RigEclipseCaseData* m_eclipseCase; + RigEclipseCaseData* m_eclipseCase; - std::vector m_timeSteps; - std::vector m_daysSinceSimulationStart; - - ecl_file_type* m_ecl_init_file; // File access to static results - cvf::ref m_dynamicResultsAccess; // File access to dynamic results + ecl_file_type* m_ecl_init_file; // File access to static results + cvf::ref m_dynamicResultsAccess; // File access to dynamic results }; diff --git a/ApplicationCode/FileInterface/RifReaderInterface.cpp b/ApplicationCode/FileInterface/RifReaderInterface.cpp index b7c68a5f0b..5ac64818a7 100644 --- a/ApplicationCode/FileInterface/RifReaderInterface.cpp +++ b/ApplicationCode/FileInterface/RifReaderInterface.cpp @@ -68,6 +68,9 @@ bool RifReaderInterface::isNNCsEnabled() return false; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- const QString RifReaderInterface::faultIncludeFileAbsolutePathPrefix() { if (m_settings.notNull()) @@ -77,3 +80,43 @@ const QString RifReaderInterface::faultIncludeFileAbsolutePathPrefix() return QString(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifReaderInterface::setTimeStepFilter(const std::vector& fileTimeStepIndices) +{ + m_fileTimeStepIndices = fileTimeStepIndices; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RifReaderInterface::isTimeStepIncludedByFilter(size_t timeStepIndex) const +{ + if (m_fileTimeStepIndices.empty()) return true; + + for (auto i : m_fileTimeStepIndices) + { + if (i == timeStepIndex) + { + return true; + } + } + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +size_t RifReaderInterface::timeStepIndexOnFile(size_t timeStepIndex) const +{ + if (timeStepIndex < m_fileTimeStepIndices.size()) + { + return m_fileTimeStepIndices[timeStepIndex]; + } + + return timeStepIndex; +} + diff --git a/ApplicationCode/FileInterface/RifReaderInterface.h b/ApplicationCode/FileInterface/RifReaderInterface.h index be8fa983b5..a9ece3681a 100644 --- a/ApplicationCode/FileInterface/RifReaderInterface.h +++ b/ApplicationCode/FileInterface/RifReaderInterface.h @@ -20,6 +20,8 @@ #pragma once +#include "RiaPorosityModel.h" + #include "cvfBase.h" #include "cvfObject.h" @@ -43,13 +45,6 @@ class RifReaderSettings; //================================================================================================== class RifReaderInterface : public cvf::Object { -public: - enum PorosityModelResultType - { - MATRIX_RESULTS, - FRACTURE_RESULTS - }; - public: RifReaderInterface() { } virtual ~RifReaderInterface() { } @@ -64,16 +59,21 @@ public: virtual bool open(const QString& fileName, RigEclipseCaseData* eclipseCase) = 0; virtual void close() = 0; - virtual bool staticResult(const QString& result, PorosityModelResultType matrixOrFracture, std::vector* values) = 0; - virtual bool dynamicResult(const QString& result, PorosityModelResultType matrixOrFracture, size_t stepIndex, std::vector* values) = 0; - - virtual std::vector timeSteps() { std::vector timeSteps; return timeSteps; } + virtual bool staticResult(const QString& result, RiaDefines::PorosityModelType matrixOrFracture, std::vector* values) = 0; + virtual bool dynamicResult(const QString& result, RiaDefines::PorosityModelType matrixOrFracture, size_t stepIndex, std::vector* values) = 0; void setFilenamesWithFaults(const std::vector& filenames) { m_filenamesWithFaults = filenames; } std::vector filenamesWithFaults() { return m_filenamesWithFaults; } + void setTimeStepFilter(const std::vector& fileTimeStepIndices); + +protected: + bool isTimeStepIncludedByFilter(size_t timeStepIndex) const; + size_t timeStepIndexOnFile(size_t timeStepIndex) const; private: std::vector m_filenamesWithFaults; caf::PdmPointer m_settings; + + std::vector m_fileTimeStepIndices; }; diff --git a/ApplicationCode/FileInterface/RifReaderMockModel.cpp b/ApplicationCode/FileInterface/RifReaderMockModel.cpp index a8e4f37b7e..0de98cc6c7 100644 --- a/ApplicationCode/FileInterface/RifReaderMockModel.cpp +++ b/ApplicationCode/FileInterface/RifReaderMockModel.cpp @@ -20,10 +20,9 @@ #include "RifReaderMockModel.h" -#include "RifReaderInterface.h" - #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" +#include "RigEclipseResultInfo.h" //-------------------------------------------------------------------------------------------------- /// @@ -34,34 +33,34 @@ bool RifReaderMockModel::open(const QString& fileName, RigEclipseCaseData* eclip m_reservoir = eclipseCase; - RigCaseCellResultsData* cellResults = eclipseCase->results(RifReaderInterface::MATRIX_RESULTS); + RigCaseCellResultsData* cellResults = eclipseCase->results(RiaDefines::MATRIX_MODEL); - - std::vector dates; - std::vector days; - std::vector repNumbers; - - for (int i = 0; i < static_cast(m_reservoirBuilder.timeStepCount()); i++) + std::vector timeStepInfos; { - dates.push_back(QDateTime(QDate(2012+i, 6, 1))); - days.push_back(i); - repNumbers.push_back(i); + std::vector dates; + std::vector days; + std::vector repNumbers; + + for (int i = 0; i < static_cast(m_reservoirBuilder.timeStepCount()); i++) + { + dates.push_back(QDateTime(QDate(2012+i, 6, 1))); + days.push_back(i); + repNumbers.push_back(i); + } + + timeStepInfos = RigEclipseTimeStepInfo::createTimeStepInfos(dates, repNumbers, days); } for (size_t i = 0; i < m_reservoirBuilder.resultCount(); i++) { size_t resIdx = cellResults->addEmptyScalarResult(RiaDefines::DYNAMIC_NATIVE, QString("Dynamic_Result_%1").arg(i), false); - cellResults->setTimeStepDates(resIdx, dates, days, repNumbers); + cellResults->setTimeStepInfos(resIdx, timeStepInfos); } if (m_reservoirBuilder.timeStepCount() == 0) return true; - std::vector staticDates; - staticDates.push_back(dates[0]); - std::vector staticDays; - staticDays.push_back(days[0]); - std::vector staticRepNumbers; - staticRepNumbers.push_back(0); + std::vector staticResultTimeStepInfos; + staticResultTimeStepInfos.push_back(timeStepInfos[0]); for (int i = 0; i < static_cast(m_reservoirBuilder.resultCount()); i++) { @@ -72,7 +71,7 @@ bool RifReaderMockModel::open(const QString& fileName, RigEclipseCaseData* eclip if (i > 1) resIndex = i; size_t resIdx = cellResults->addEmptyScalarResult(RiaDefines::STATIC_NATIVE, QString("Static_Result_%1%2").arg(resIndex).arg(varEnd), false); - cellResults->setTimeStepDates(resIdx, staticDates, staticDays, staticRepNumbers); + cellResults->setTimeStepInfos(resIdx, staticResultTimeStepInfos); } @@ -81,7 +80,7 @@ bool RifReaderMockModel::open(const QString& fileName, RigEclipseCaseData* eclip size_t resIdx; \ QString resultName(Name); \ resIdx = cellResults->addEmptyScalarResult(RiaDefines::INPUT_PROPERTY, resultName, false); \ - cellResults->setTimeStepDates(resIdx, staticDates, staticDays, staticRepNumbers); \ + cellResults->setTimeStepInfos(resIdx, staticResultTimeStepInfos); \ cellResults->cellScalarResults(resIdx).resize(1); \ std::vector& values = cellResults->cellScalarResults(resIdx)[0]; \ this->inputProperty(resultName, &values); \ @@ -114,7 +113,7 @@ bool RifReaderMockModel::inputProperty(const QString& propertyName, std::vector< //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RifReaderMockModel::staticResult(const QString& result, RifReaderInterface::PorosityModelResultType matrixOrFracture, std::vector* values) +bool RifReaderMockModel::staticResult(const QString& result, RiaDefines::PorosityModelType matrixOrFracture, std::vector* values) { m_reservoirBuilder.staticResult(m_reservoir, result, values); @@ -124,7 +123,7 @@ bool RifReaderMockModel::staticResult(const QString& result, RifReaderInterface: //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RifReaderMockModel::dynamicResult(const QString& result, RifReaderInterface::PorosityModelResultType matrixOrFracture, size_t stepIndex, std::vector* values) +bool RifReaderMockModel::dynamicResult(const QString& result, RiaDefines::PorosityModelType matrixOrFracture, size_t stepIndex, std::vector* values) { m_reservoirBuilder.dynamicResult(m_reservoir, result, stepIndex, values); diff --git a/ApplicationCode/FileInterface/RifReaderMockModel.h b/ApplicationCode/FileInterface/RifReaderMockModel.h index 33f5204f5b..068cab7a6d 100644 --- a/ApplicationCode/FileInterface/RifReaderMockModel.h +++ b/ApplicationCode/FileInterface/RifReaderMockModel.h @@ -39,8 +39,8 @@ public: virtual bool open( const QString& fileName, RigEclipseCaseData* eclipseCase ); virtual void close(); - virtual bool staticResult( const QString& result, RifReaderInterface::PorosityModelResultType matrixOrFracture, std::vector* values ); - virtual bool dynamicResult( const QString& result, RifReaderInterface::PorosityModelResultType matrixOrFracture, size_t stepIndex, std::vector* values ); + virtual bool staticResult( const QString& result, RiaDefines::PorosityModelType matrixOrFracture, std::vector* values ); + virtual bool dynamicResult( const QString& result, RiaDefines::PorosityModelType matrixOrFracture, size_t stepIndex, std::vector* values ); private: void populateReservoir(RigEclipseCaseData* eclipseCase); diff --git a/ApplicationCode/ModelVisualization/CMakeLists_files.cmake b/ApplicationCode/ModelVisualization/CMakeLists_files.cmake index 6dee791823..255db8770f 100644 --- a/ApplicationCode/ModelVisualization/CMakeLists_files.cmake +++ b/ApplicationCode/ModelVisualization/CMakeLists_files.cmake @@ -36,7 +36,6 @@ ${CEE_CURRENT_LIST_DIR}RivSingleCellPartGenerator.h ${CEE_CURRENT_LIST_DIR}RivSimWellPipeSourceInfo.h ${CEE_CURRENT_LIST_DIR}RivWellSpheresPartMgr.h ${CEE_CURRENT_LIST_DIR}RivPartPriority.h -${CEE_CURRENT_LIST_DIR}RivWellConnectionsPartMgr.h ${CEE_CURRENT_LIST_DIR}RivObjectSourceInfo.h ${CEE_CURRENT_LIST_DIR}RivWellConnectionsPartMgr.h ${CEE_CURRENT_LIST_DIR}RivFishbonesSubsPartMgr.h @@ -71,7 +70,6 @@ ${CEE_CURRENT_LIST_DIR}RivPipeQuadToSegmentMapper.cpp ${CEE_CURRENT_LIST_DIR}RivSingleCellPartGenerator.cpp ${CEE_CURRENT_LIST_DIR}RivSimWellPipeSourceInfo.cpp ${CEE_CURRENT_LIST_DIR}RivWellSpheresPartMgr.cpp -${CEE_CURRENT_LIST_DIR}RivWellConnectionsPartMgr.cpp ${CEE_CURRENT_LIST_DIR}RivObjectSourceInfo.cpp ${CEE_CURRENT_LIST_DIR}RivWellConnectionsPartMgr.cpp ${CEE_CURRENT_LIST_DIR}RivFishbonesSubsPartMgr.cpp diff --git a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp index a6051d74e2..bf605cf8a9 100644 --- a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionBoxPartMgr.cpp @@ -94,7 +94,6 @@ void RivIntersectionBoxPartMgr::updateCellResultColor(size_t timeStepIndex) RimEclipseCellColors* cellResultColors = eclipseView->cellResult(); CVF_ASSERT(cellResultColors); - RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel()); RigEclipseCaseData* eclipseCase = eclipseView->eclipseCase()->eclipseCaseData(); // CrossSections diff --git a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp index 0a5b25cf01..24222d837b 100644 --- a/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/Intersections/RivIntersectionPartMgr.cpp @@ -102,7 +102,6 @@ void RivIntersectionPartMgr::updateCellResultColor(size_t timeStepIndex) RimEclipseCellColors* cellResultColors = eclipseView->cellResult(); CVF_ASSERT(cellResultColors); - RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel()); RigEclipseCaseData* eclipseCase = eclipseView->eclipseCase()->eclipseCaseData(); // CrossSections diff --git a/ApplicationCode/ModelVisualization/RivCellEdgeGeometryUtils.cpp b/ApplicationCode/ModelVisualization/RivCellEdgeGeometryUtils.cpp index a60f84bd71..c22cc08877 100644 --- a/ApplicationCode/ModelVisualization/RivCellEdgeGeometryUtils.cpp +++ b/ApplicationCode/ModelVisualization/RivCellEdgeGeometryUtils.cpp @@ -299,8 +299,6 @@ cvf::ref RivCellEdgeGeometryUtils::createCellEdgeResultAccess { cvf::ref cellEdgeResultAccessor = new RigCellEdgeResultAccessor(); - RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel()); - if (cellEdgeResultColors->propertyType() == RimCellEdgeColors::ANY_SINGLE_PROPERTY) { cvf::ref daObj = RivCellEdgeGeometryUtils::createCellCenterResultAccessor(cellEdgeResultColors->singleVarEdgeResultColors(), timeStepIndex, eclipseCase, grid); @@ -327,6 +325,7 @@ cvf::ref RivCellEdgeGeometryUtils::createCellEdgeResultAccess adjustedTimeStep = 0; } + RiaDefines::PorosityModelType porosityModel = cellResultColors->porosityModel(); cvf::ref daObj = RigResultAccessorFactory::createFromResultIdx(eclipseCase, grid->gridIndex(), porosityModel, adjustedTimeStep, resultIndices[cubeFaceIdx]); cellEdgeResultAccessor->setDataAccessObjectForFace(static_cast(cubeFaceIdx), daObj.p()); } diff --git a/ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp b/ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp index 4efb3f420d..d6b94ad242 100644 --- a/ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivFaultPartMgr.cpp @@ -105,7 +105,6 @@ void RivFaultPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCell updateNNCColors(cellResultColors); - RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel()); RimEclipseView* eclipseView = cellResultColors->reservoirView(); RigEclipseCaseData* eclipseCase = eclipseView->eclipseCase()->eclipseCaseData(); diff --git a/ApplicationCode/ModelVisualization/RivTernaryTextureCoordsCreator.cpp b/ApplicationCode/ModelVisualization/RivTernaryTextureCoordsCreator.cpp index 6f625ae6ea..b63e4fb155 100644 --- a/ApplicationCode/ModelVisualization/RivTernaryTextureCoordsCreator.cpp +++ b/ApplicationCode/ModelVisualization/RivTernaryTextureCoordsCreator.cpp @@ -55,7 +55,7 @@ RivTernaryTextureCoordsCreator::RivTernaryTextureCoordsCreator( if (cellResultColors->hasStaticResult()) resTimeStepIdx = 0; - RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel()); + RiaDefines::PorosityModelType porosityModel = cellResultColors->porosityModel(); cvf::ref soil = RigResultAccessorFactory::createFromUiResultName(eclipseCase, gridIndex, porosityModel, resTimeStepIdx, "SOIL"); cvf::ref sgas = RigResultAccessorFactory::createFromUiResultName(eclipseCase, gridIndex, porosityModel, resTimeStepIdx, "SGAS"); @@ -89,7 +89,7 @@ RivTernaryTextureCoordsCreator::RivTernaryTextureCoordsCreator( if (cellResultColors->hasStaticResult()) resTimeStepIdx = 0; - RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel()); + RiaDefines::PorosityModelType porosityModel = cellResultColors->porosityModel(); size_t gridIndex = 0; cvf::ref soil = RigResultAccessorFactory::createFromUiResultName(eclipseCase, gridIndex, porosityModel, resTimeStepIdx, "SOIL"); diff --git a/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake b/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake index 6a56736376..128cb1580d 100644 --- a/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake +++ b/ApplicationCode/ProjectDataModel/CMakeLists_files.cmake @@ -92,6 +92,7 @@ ${CEE_CURRENT_LIST_DIR}RimEclipseGeometrySelectionItem.h ${CEE_CURRENT_LIST_DIR}RimStimPlanLegendConfig.h ${CEE_CURRENT_LIST_DIR}RimStimPlanColors.h ${CEE_CURRENT_LIST_DIR}RimDialogData.h +${CEE_CURRENT_LIST_DIR}RimTimeStepFilter.h ) set (SOURCE_GROUP_SOURCE_FILES @@ -182,6 +183,7 @@ ${CEE_CURRENT_LIST_DIR}RimEclipseGeometrySelectionItem.cpp ${CEE_CURRENT_LIST_DIR}RimStimPlanLegendConfig.cpp ${CEE_CURRENT_LIST_DIR}RimStimPlanColors.cpp ${CEE_CURRENT_LIST_DIR}RimDialogData.cpp +${CEE_CURRENT_LIST_DIR}RimTimeStepFilter.cpp ) list(APPEND CODE_HEADER_FILES diff --git a/ApplicationCode/ProjectDataModel/Completions/RimFishbonesMultipleSubs.cpp b/ApplicationCode/ProjectDataModel/Completions/RimFishbonesMultipleSubs.cpp index 498553ac38..5ffc10fb9d 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimFishbonesMultipleSubs.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimFishbonesMultipleSubs.cpp @@ -669,7 +669,9 @@ void RimFishbonesMultipleSubs::computeSubLateralIndices() m_subLateralIndices.clear(); for (size_t subIndex = 0; subIndex < m_locationOfSubs().size(); ++subIndex) { - SubLateralIndex subLateralIndex{ subIndex }; + SubLateralIndex subLateralIndex; + subLateralIndex.subIndex = subIndex; + for (size_t lateralIndex = 0; lateralIndex < m_lateralCountPerSub(); ++lateralIndex) { subLateralIndex.lateralIndices.push_back(lateralIndex); diff --git a/ApplicationCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp index 90acb4e88b..1a25c08d6e 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp @@ -28,6 +28,8 @@ #include "cafPdmUiCheckBoxEditor.h" +#include + #include // Needed for HUGE_VAL on Linux @@ -58,6 +60,7 @@ RimFlowCharacteristicsPlot::RimFlowCharacteristicsPlot() CAF_PDM_InitFieldNoDefault(&m_timeStepSelectionType, "TimeSelectionType", "Time Steps", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_selectedTimeSteps, "SelectedTimeSteps", "", "", "", ""); + CAF_PDM_InitField(&m_maxPvFraction, "CellPVThreshold", 0.1, "Aquifer Cell Threshold", "", "Exclude Aquifer Effects by adding a Cell Pore Volume Threshold as Fraction of Total Pore Volume.", ""); CAF_PDM_InitField(&m_showLegend, "ShowLegend", true, "Legend", "", "", ""); @@ -119,7 +122,7 @@ void RimFlowCharacteristicsPlot::updateCurrentTimeStep() if (!m_flowDiagSolution()) return; RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults(); - std::vector calculatedTimesteps = flowResult->calculatedTimeSteps(); + std::vector calculatedTimesteps = flowResult->calculatedTimeSteps(RigFlowDiagResultAddress::PHASE_ALL); if (m_currentlyPlottedTimeSteps == calculatedTimesteps) return; @@ -171,7 +174,7 @@ QList RimFlowCharacteristicsPlot::calculateValueOptions( if ( m_flowDiagSolution ) { RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults(); - std::vector calculatedTimesteps = flowResult->calculatedTimeSteps(); + std::vector calculatedTimesteps = flowResult->calculatedTimeSteps(RigFlowDiagResultAddress::PHASE_ALL); QStringList timeStepDates = m_case->timeStepStrings(); @@ -198,6 +201,7 @@ void RimFlowCharacteristicsPlot::defineUiOrdering(QString uiConfigName, caf::Pdm if (m_timeStepSelectionType == SELECT_AVAILABLE) uiOrdering.add(&m_selectedTimeSteps); uiOrdering.add(&m_showLegend); + uiOrdering.add(&m_maxPvFraction); uiOrdering.skipRemainingFields(); } @@ -262,7 +266,7 @@ void RimFlowCharacteristicsPlot::loadDataAndUpdate() if (m_flowDiagSolution && m_flowCharPlotWidget) { RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults(); - std::vector calculatedTimesteps = flowResult->calculatedTimeSteps(); + std::vector calculatedTimesteps = flowResult->calculatedTimeSteps(RigFlowDiagResultAddress::PHASE_ALL); if (m_timeStepSelectionType == SELECT_AVAILABLE) { @@ -288,14 +292,14 @@ void RimFlowCharacteristicsPlot::loadDataAndUpdate() for ( int timeStepIdx: calculatedTimesteps ) { - lorenzVals[timeStepIdx] = flowResult->flowCharacteristicsResults(timeStepIdx).m_lorenzCoefficient; + lorenzVals[timeStepIdx] = flowResult->flowCharacteristicsResults(timeStepIdx, m_maxPvFraction()).m_lorenzCoefficient; } m_flowCharPlotWidget->setLorenzCurve(timeStepStrings, timeStepDates, lorenzVals); for ( int timeStepIdx: calculatedTimesteps ) { - const auto & flowCharResults = flowResult->flowCharacteristicsResults(timeStepIdx); + const auto flowCharResults = flowResult->flowCharacteristicsResults(timeStepIdx, m_maxPvFraction()); m_flowCharPlotWidget->addFlowCapStorageCapCurve(timeStepDates[timeStepIdx], flowCharResults.m_flowCapStorageCapCurve.first, flowCharResults.m_flowCapStorageCapCurve.second); diff --git a/ApplicationCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.h b/ApplicationCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.h index d8bfafd664..8e1747d129 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.h +++ b/ApplicationCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.h @@ -87,6 +87,7 @@ private: caf::PdmField > m_timeStepSelectionType; caf::PdmField > m_selectedTimeSteps; caf::PdmField m_showLegend; + caf::PdmField m_maxPvFraction; std::vector m_currentlyPlottedTimeSteps; diff --git a/ApplicationCode/ProjectDataModel/Flow/RimFlowDiagSolution.cpp b/ApplicationCode/ProjectDataModel/Flow/RimFlowDiagSolution.cpp index 8b79214dd1..b13e1222dd 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimFlowDiagSolution.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimFlowDiagSolution.cpp @@ -107,7 +107,7 @@ RigFlowDiagResults* RimFlowDiagSolution::flowDiagResults() CVF_ASSERT(eclCase && eclCase->eclipseCaseData() ); - timeStepCount = eclCase->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->maxTimeStepCount(); + timeStepCount = eclCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->maxTimeStepCount(); } @@ -171,7 +171,7 @@ std::map > RimFlowDiagSolution::allTracerActiveCel { const cvf::Collection& wellResults = eclCase->eclipseCaseData()->wellResults(); RigMainGrid* mainGrid = eclCase->eclipseCaseData()->mainGrid(); - RigActiveCellInfo* activeCellInfo = eclCase->eclipseCaseData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS); //Todo: Must come from the results definition + RigActiveCellInfo* activeCellInfo = eclCase->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL); //Todo: Must come from the results definition for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx ) { diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp index 17be765928..88d747e6ea 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp @@ -209,7 +209,7 @@ void RimWellAllocationPlot::updateFromWell() { bool isProducer = ( wellResults->wellProductionType(m_timeStep) == RigWellResultFrame::PRODUCER || wellResults->wellProductionType(m_timeStep) == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE ); - RigEclCellIndexCalculator cellIdxCalc(m_case->eclipseCaseData()->mainGrid(), m_case->eclipseCaseData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)); + RigEclCellIndexCalculator cellIdxCalc(m_case->eclipseCaseData()->mainGrid(), m_case->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL)); wfCalculator.reset(new RigAccWellFlowCalculator(pipeBranchesCLCoords, pipeBranchesCellIds, tracerFractionCellValues, @@ -341,7 +341,7 @@ std::map *> RimWellAllocationPlot::findReleva { if ( m_flowDiagSolution->tracerStatusInTimeStep(tracerName, m_timeStep) == requestedTracerType ) { - RigFlowDiagResultAddress resAddr(RIG_FLD_CELL_FRACTION_RESNAME, tracerName.toStdString()); + RigFlowDiagResultAddress resAddr(RIG_FLD_CELL_FRACTION_RESNAME, RigFlowDiagResultAddress::PHASE_ALL, tracerName.toStdString()); const std::vector* tracerCellFractions = m_flowDiagSolution->flowDiagResults()->resultValues(resAddr, m_timeStep); if (tracerCellFractions) tracerCellFractionValues[tracerName] = tracerCellFractions; } diff --git a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp index f5a4e77742..7d554f61bb 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp @@ -346,8 +346,8 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView) { caseName = eclipseView->eclipseCase()->caseUserDescription(); totCellCount = QString::number(eclipseView->mainGrid()->globalCellArray().size()); - size_t mxActCellCount = eclipseView->eclipseCase()->eclipseCaseData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->reservoirActiveCellCount(); - size_t frActCellCount = eclipseView->eclipseCase()->eclipseCaseData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->reservoirActiveCellCount(); + size_t mxActCellCount = eclipseView->eclipseCase()->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL)->reservoirActiveCellCount(); + size_t frActCellCount = eclipseView->eclipseCase()->eclipseCaseData()->activeCellInfo(RiaDefines::FRACTURE_MODEL)->reservoirActiveCellCount(); if (frActCellCount > 0) activeCellCountText += "Matrix : "; activeCellCountText += QString::number(mxActCellCount); if (frActCellCount > 0) activeCellCountText += " Fracture : " + QString::number(frActCellCount); diff --git a/ApplicationCode/ProjectDataModel/RimCase.cpp b/ApplicationCode/ProjectDataModel/RimCase.cpp index 0dc84cde35..b9ab321d5c 100644 --- a/ApplicationCode/ProjectDataModel/RimCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimCase.cpp @@ -19,17 +19,15 @@ #include "RimCase.h" +#include "RiaApplication.h" +#include "RimFormationNames.h" +#include "RimFormationNamesCollection.h" +#include "RimOilField.h" +#include "RimProject.h" +#include "RimTimeStepFilter.h" + #include "cafPdmObjectFactory.h" -#include -#include -#include -#include -#include "RimProject.h" -#include "RiaApplication.h" -#include "RimOilField.h" -#include "RimFormationNamesCollection.h" -#include "RimFormationNames.h" CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimCase, "RimCase"); @@ -45,7 +43,11 @@ RimCase::RimCase() caseId.uiCapability()->setUiReadOnly(true); CAF_PDM_InitFieldNoDefault(&activeFormationNames, "DefaultFormationNames", "Formation Names File", "", "", ""); - + + CAF_PDM_InitFieldNoDefault(&m_timeStepFilter, "TimeStepFilter", "Time Step Filter", "", "", ""); + m_timeStepFilter.uiCapability()->setUiHidden(true); + m_timeStepFilter.uiCapability()->setUiTreeChildrenHidden(true); + m_timeStepFilter = new RimTimeStepFilter; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimCase.h b/ApplicationCode/ProjectDataModel/RimCase.h index cb274de8f0..cac5577357 100644 --- a/ApplicationCode/ProjectDataModel/RimCase.h +++ b/ApplicationCode/ProjectDataModel/RimCase.h @@ -22,6 +22,7 @@ #include "cafPdmPtrField.h" #include "cafPdmField.h" #include "cafPdmObject.h" +#include "cafPdmChildField.h" #include "cvfBase.h" #include "cvfVector3.h" @@ -30,6 +31,7 @@ class RimView; class RimFormationNames; +class RimTimeStepFilter; namespace cvf { class BoundingBox; @@ -68,6 +70,9 @@ protected: virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override; private: virtual caf::PdmFieldHandle* userDescriptionField() override { return &caseUserDescription; } + +protected: + caf::PdmChildField m_timeStepFilter; }; diff --git a/ApplicationCode/ProjectDataModel/RimCellEdgeColors.h b/ApplicationCode/ProjectDataModel/RimCellEdgeColors.h index 4972ff8e9f..409208e767 100644 --- a/ApplicationCode/ProjectDataModel/RimCellEdgeColors.h +++ b/ApplicationCode/ProjectDataModel/RimCellEdgeColors.h @@ -20,8 +20,6 @@ #pragma once -#include "RiaDefines.h" - #include "cafAppEnum.h" #include "cafFixedArray.h" #include "cafPdmChildField.h" diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp index 15e66567ea..2750e0e6f1 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp @@ -380,7 +380,7 @@ void RimEclipseCase::computeCachedData() pInf.setNextProgressIncrement(17); pInf.setProgressDescription("Calculating faults"); - rigEclipseCase->mainGrid()->calculateFaults(rigEclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)); + rigEclipseCase->mainGrid()->calculateFaults(rigEclipseCase->activeCellInfo(RiaDefines::MATRIX_MODEL)); pInf.incrementProgress(); pInf.setProgressDescription("Calculating Formation Names Result"); @@ -414,8 +414,8 @@ void RimEclipseCase::setReservoirData(RigEclipseCaseData* eclipseCase) m_rigEclipseCase = eclipseCase; if (this->eclipseCaseData()) { - m_fractureModelResults()->setCellResults(eclipseCaseData()->results(RifReaderInterface::FRACTURE_RESULTS)); - m_matrixModelResults()->setCellResults(eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)); + m_fractureModelResults()->setCellResults(eclipseCaseData()->results(RiaDefines::FRACTURE_MODEL)); + m_matrixModelResults()->setCellResults(eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)); m_fractureModelResults()->setMainGrid(this->eclipseCaseData()->mainGrid()); m_matrixModelResults()->setMainGrid(this->eclipseCaseData()->mainGrid()); } @@ -478,9 +478,9 @@ void RimEclipseCase::createTimeStepFormatString() //-------------------------------------------------------------------------------------------------- cvf::BoundingBox RimEclipseCase::activeCellsBoundingBox() const { - if (m_rigEclipseCase.notNull() && m_rigEclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)) + if (m_rigEclipseCase.notNull() && m_rigEclipseCase->activeCellInfo(RiaDefines::MATRIX_MODEL)) { - return m_rigEclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->geometryBoundingBox(); + return m_rigEclipseCase->activeCellInfo(RiaDefines::MATRIX_MODEL)->geometryBoundingBox(); } else { @@ -521,9 +521,9 @@ cvf::Vec3d RimEclipseCase::displayModelOffset() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimReservoirCellResultsStorage* RimEclipseCase::results(RifReaderInterface::PorosityModelResultType porosityModel) +RimReservoirCellResultsStorage* RimEclipseCase::results(RiaDefines::PorosityModelType porosityModel) { - if (porosityModel == RifReaderInterface::MATRIX_RESULTS) + if (porosityModel == RiaDefines::MATRIX_MODEL) { return m_matrixModelResults(); } @@ -534,9 +534,9 @@ RimReservoirCellResultsStorage* RimEclipseCase::results(RifReaderInterface::Poro //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -const RimReservoirCellResultsStorage* RimEclipseCase::results(RifReaderInterface::PorosityModelResultType porosityModel) const +const RimReservoirCellResultsStorage* RimEclipseCase::results(RiaDefines::PorosityModelType porosityModel) const { - if (porosityModel == RifReaderInterface::MATRIX_RESULTS) + if (porosityModel == RiaDefines::MATRIX_MODEL) { return m_matrixModelResults(); } @@ -592,7 +592,7 @@ bool RimEclipseCase::openReserviorCase() } { - RimReservoirCellResultsStorage* results = this->results(RifReaderInterface::MATRIX_RESULTS); + RimReservoirCellResultsStorage* results = this->results(RiaDefines::MATRIX_MODEL); if (results->cellResults()) { results->cellResults()->createPlaceholderResultEntries(); @@ -607,7 +607,7 @@ bool RimEclipseCase::openReserviorCase() } { - RimReservoirCellResultsStorage* results = this->results(RifReaderInterface::FRACTURE_RESULTS); + RimReservoirCellResultsStorage* results = this->results(RiaDefines::FRACTURE_MODEL); if (results->cellResults()) results->cellResults()->createPlaceholderResultEntries(); } @@ -636,7 +636,7 @@ QStringList RimEclipseCase::timeStepStrings() const { QStringList stringList; - int timeStepCount = static_cast(results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->maxTimeStepCount()); + int timeStepCount = static_cast(results(RiaDefines::MATRIX_MODEL)->cellResults()->maxTimeStepCount()); for (int i = 0; i < timeStepCount; i++) { stringList += this->timeStepName(i); @@ -665,13 +665,13 @@ void RimEclipseCase::reloadDataAndUpdate() { if (this->eclipseCaseData()) { - RigCaseCellResultsData* matrixModelResults = eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS); + RigCaseCellResultsData* matrixModelResults = eclipseCaseData()->results(RiaDefines::MATRIX_MODEL); if (matrixModelResults) { matrixModelResults->clearAllResults(); } - RigCaseCellResultsData* fractureModelResults = eclipseCaseData()->results(RifReaderInterface::FRACTURE_RESULTS); + RigCaseCellResultsData* fractureModelResults = eclipseCaseData()->results(RiaDefines::FRACTURE_MODEL); if (fractureModelResults) { fractureModelResults->clearAllResults(); @@ -738,5 +738,5 @@ double RimEclipseCase::characteristicCellSize() const //-------------------------------------------------------------------------------------------------- std::vector RimEclipseCase::timeStepDates() const { - return results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->timeStepDates(); + return results(RiaDefines::MATRIX_MODEL)->cellResults()->timeStepDates(); } diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.h b/ApplicationCode/ProjectDataModel/RimEclipseCase.h index be06012899..60fd3b6c48 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.h @@ -20,7 +20,7 @@ #pragma once -#include "RifReaderInterface.h" +#include "RiaPorosityModel.h" #include "RimCase.h" #include "RiaDefines.h" @@ -73,8 +73,8 @@ public: const RigEclipseCaseData* eclipseCaseData() const; cvf::Color3f defaultWellColor(const QString& wellName); - RimReservoirCellResultsStorage* results(RifReaderInterface::PorosityModelResultType porosityModel); - const RimReservoirCellResultsStorage* results(RifReaderInterface::PorosityModelResultType porosityModel) const; + RimReservoirCellResultsStorage* results(RiaDefines::PorosityModelType porosityModel); + const RimReservoirCellResultsStorage* results(RiaDefines::PorosityModelType porosityModel) const; RimEclipseView* createAndAddReservoirView(); RimEclipseView* createCopyAndAddView(const RimEclipseView* sourceView); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCaseCollection.cpp b/ApplicationCode/ProjectDataModel/RimEclipseCaseCollection.cpp index ae8410b0fc..3a71cb4472 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCaseCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseCaseCollection.cpp @@ -171,7 +171,7 @@ RigMainGrid* RimEclipseCaseCollection::registerCaseInGridCollection(RigEclipseCa // This is the first insertion of this grid, compute cached data rigEclipseCase->mainGrid()->computeCachedData(); - rigEclipseCase->mainGrid()->calculateFaults(rigEclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)); + rigEclipseCase->mainGrid()->calculateFaults(rigEclipseCase->activeCellInfo(RiaDefines::MATRIX_MODEL)); equalGrid = rigEclipseCase->mainGrid(); } diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp b/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp index aacc1e13af..c893acc49d 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseCellColors.cpp @@ -344,8 +344,7 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep) CVF_ASSERT(eclipseCase); if (!eclipseCase) return; - RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(this->porosityModel()); - RigCaseCellResultsData* cellResultsData = eclipseCase->results(porosityModel); + RigCaseCellResultsData* cellResultsData = eclipseCase->results(this->porosityModel()); CVF_ASSERT(cellResultsData); double globalMin, globalMax; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCellColors.h b/ApplicationCode/ProjectDataModel/RimEclipseCellColors.h index afba2778ab..184be112e3 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCellColors.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseCellColors.h @@ -20,7 +20,6 @@ #pragma once -#include "RiaDefines.h" #include "RimEclipseResultDefinition.h" #include "cafPdmChildArrayField.h" diff --git a/ApplicationCode/ProjectDataModel/RimEclipseInputCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseInputCase.cpp index 10e602ee4a..46d0e1ffb7 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseInputCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseInputCase.cpp @@ -88,11 +88,11 @@ void RimEclipseInputCase::openDataFileSet(const QStringList& fileNames) if (fileNames.contains(RiaDefines::mockModelBasicInputCase())) { cvf::ref readerInterface = this->createMockModel(fileNames[0]); - results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(readerInterface.p()); - results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(readerInterface.p()); + results(RiaDefines::MATRIX_MODEL)->setReaderInterface(readerInterface.p()); + results(RiaDefines::FRACTURE_MODEL)->setReaderInterface(readerInterface.p()); - eclipseCaseData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->computeDerivedData(); - eclipseCaseData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->computeDerivedData(); + eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL)->computeDerivedData(); + eclipseCaseData()->activeCellInfo(RiaDefines::FRACTURE_MODEL)->computeDerivedData(); QFileInfo gridFileName(fileNames[0]); QString caseName = gridFileName.completeBaseName(); @@ -206,8 +206,8 @@ bool RimEclipseInputCase::openEclipseGridFile() CVF_ASSERT(this->eclipseCaseData()); CVF_ASSERT(readerInterface.notNull()); - results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(readerInterface.p()); - results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(readerInterface.p()); + results(RiaDefines::MATRIX_MODEL)->setReaderInterface(readerInterface.p()); + results(RiaDefines::FRACTURE_MODEL)->setReaderInterface(readerInterface.p()); this->eclipseCaseData()->mainGrid()->setFlipAxis(flipXAxis, flipYAxis); @@ -219,8 +219,8 @@ bool RimEclipseInputCase::openEclipseGridFile() RiaApplication* app = RiaApplication::instance(); if (app->preferences()->autocomputeDepthRelatedProperties) { - RimReservoirCellResultsStorage* matrixResults = results(RifReaderInterface::MATRIX_RESULTS); - RimReservoirCellResultsStorage* fractureResults = results(RifReaderInterface::FRACTURE_RESULTS); + RimReservoirCellResultsStorage* matrixResults = results(RiaDefines::MATRIX_MODEL); + RimReservoirCellResultsStorage* fractureResults = results(RiaDefines::FRACTURE_MODEL); matrixResults->computeDepthRelatedResults(); fractureResults->computeDepthRelatedResults(); @@ -318,7 +318,7 @@ void RimEclipseInputCase::loadAndSyncronizeInputProperties() for (const QString fileKeyword : fileKeywordSet) { { - QString resultName = this->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(fileKeyword); + QString resultName = this->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->makeResultNameUnique(fileKeyword); if (RifEclipseInputFileTools::readProperty(filenames[i], this->eclipseCaseData(), fileKeyword, resultName)) { RimEclipseInputProperty* inputProperty = new RimEclipseInputProperty; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseInputProperty.cpp b/ApplicationCode/ProjectDataModel/RimEclipseInputProperty.cpp index d51206994b..6d9024ca68 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseInputProperty.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseInputProperty.cpp @@ -91,7 +91,7 @@ void RimEclipseInputProperty::fieldChangedByUi(const caf::PdmFieldHandle* change QString oldName = oldValue.toString(); QString newName = newValue.toString(); - RigCaseCellResultsData* matrixResults = rimCase->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS); + RigCaseCellResultsData* matrixResults = rimCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL); if (matrixResults) { if (matrixResults->updateResultName(RiaDefines::INPUT_PROPERTY, oldName, newName)) @@ -100,7 +100,7 @@ void RimEclipseInputProperty::fieldChangedByUi(const caf::PdmFieldHandle* change } } - RigCaseCellResultsData* fracResults = rimCase->eclipseCaseData()->results(RifReaderInterface::FRACTURE_RESULTS); + RigCaseCellResultsData* fracResults = rimCase->eclipseCaseData()->results(RiaDefines::FRACTURE_MODEL); if (fracResults) { if (fracResults->updateResultName(RiaDefines::INPUT_PROPERTY, oldName, newName)) diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp index 0cae5e39c7..40d0250760 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultCase.cpp @@ -29,14 +29,15 @@ #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" +#include "RigFlowDiagSolverInterface.h" #include "RigMainGrid.h" +#include "RimFlowDiagSolution.h" #include "RimMockModelSettings.h" #include "RimProject.h" #include "RimReservoirCellResultsStorage.h" +#include "RimTimeStepFilter.h" #include "RimTools.h" -#include "RimFlowDiagSolution.h" -#include "RigFlowDiagSolverInterface.h" #include "cafPdmSettings.h" #include "cafPdmUiPropertyViewDialog.h" @@ -111,6 +112,11 @@ bool RimEclipseResultCase::openEclipseGridFile() readerInterface->setReaderSetting(prefs->readerSettings()); readerInterface->setFilenamesWithFaults(this->filesContainingFaults()); + if (!m_timeStepFilter->timeStepIndicesToImport().empty()) + { + readerInterface->setTimeStepFilter(m_timeStepFilter->timeStepIndicesToImport()); + } + cvf::ref eclipseCase = new RigEclipseCaseData; if (!readerInterface->open(caseFileName(), eclipseCase.p())) { @@ -122,8 +128,8 @@ bool RimEclipseResultCase::openEclipseGridFile() this->setReservoirData( eclipseCase.p() ); } - results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(readerInterface.p()); - results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(readerInterface.p()); + results(RiaDefines::MATRIX_MODEL)->setReaderInterface(readerInterface.p()); + results(RiaDefines::FRACTURE_MODEL)->setReaderInterface(readerInterface.p()); progInfo.incrementProgress(); @@ -136,14 +142,11 @@ bool RimEclipseResultCase::openEclipseGridFile() m_gridAndWellDataIsReadFromFile = true; m_activeCellInfoIsReadFromFile = true; - if (eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->hasFlowDiagUsableFluxes()) + m_flowDagSolverInterface = new RigFlowDiagSolverInterface(this); + + if (m_flowDiagSolutions.size() == 0) { - m_flowDagSolverInterface = new RigFlowDiagSolverInterface(this); - - if (m_flowDiagSolutions.size() == 0) - { - m_flowDiagSolutions.push_back(new RimFlowDiagSolution()); - } + m_flowDiagSolutions.push_back(new RimFlowDiagSolution()); } return true; @@ -185,7 +188,7 @@ bool RimEclipseResultCase::openAndReadActiveCellData(RigEclipseCaseData* mainEcl CVF_ASSERT(mainEclipseCase && mainEclipseCase->mainGrid()); eclipseCase->setMainGrid(mainEclipseCase->mainGrid()); - std::vector timeStepDates = mainEclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->timeStepDates(); + std::vector timeStepDates = mainEclipseCase->results(RiaDefines::MATRIX_MODEL)->timeStepDates(); if (timeStepDates.size() == 0) { return false; @@ -204,8 +207,8 @@ bool RimEclipseResultCase::openAndReadActiveCellData(RigEclipseCaseData* mainEcl readerInterface = readerEclipseOutput; } - results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(readerInterface.p()); - results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(readerInterface.p()); + results(RiaDefines::MATRIX_MODEL)->setReaderInterface(readerInterface.p()); + results(RiaDefines::FRACTURE_MODEL)->setReaderInterface(readerInterface.p()); CVF_ASSERT(this->eclipseCaseData()); CVF_ASSERT(readerInterface.notNull()); @@ -463,5 +466,8 @@ void RimEclipseResultCase::defineUiOrdering(QString uiConfigName, caf::PdmUiOrde group->add(&flipXAxis); group->add(&flipYAxis); + auto group1 = uiOrdering.addNewGroup("Time Step Filter"); + group1->setCollapsedByDefault(true); + m_timeStepFilter->uiOrdering(uiConfigName, *group1); } diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp index 4ac3dd0136..f64c6f4613 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp @@ -82,6 +82,7 @@ RimEclipseResultDefinition::RimEclipseResultDefinition() m_selectedTracers.uiCapability()->setUiHidden(true); CAF_PDM_InitFieldNoDefault(&m_flowTracerSelectionMode, "FlowTracerSelectionMode", "Tracers", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_phaseSelection, "PhaseSelection", "Phases", "", "", ""); // Ui only fields @@ -131,6 +132,7 @@ void RimEclipseResultDefinition::simpleCopy(const RimEclipseResultDefinition* ot this->setFlowSolution(other->m_flowSolution()); this->setSelectedTracers(other->m_selectedTracers()); m_flowTracerSelectionMode = other->m_flowTracerSelectionMode(); + m_phaseSelection = other->m_phaseSelection; } //-------------------------------------------------------------------------------------------------- @@ -151,9 +153,7 @@ RimReservoirCellResultsStorage* RimEclipseResultDefinition::currentGridCellResul { if (!m_eclipseCase ) return nullptr; - RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_porosityModel()); - - return m_eclipseCase->results(porosityModel); + return m_eclipseCase->results(m_porosityModel()); } //-------------------------------------------------------------------------------------------------- @@ -239,6 +239,11 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha loadDataAndUpdate(); } + if (&m_phaseSelection == changedField) + { + loadDataAndUpdate(); + } + if (&m_selectedTracersUiFieldFilter == changedField) { auto visibleTracerNames = tracerNamesMatchingFilter(); @@ -421,18 +426,11 @@ QList RimEclipseResultDefinition::calculateValueOptions( if ( fieldNeedingOptions == &m_resultTypeUiField ) { - bool hasFlowDiagFluxes = false; - RimEclipseResultCase* eclResCase = dynamic_cast(m_eclipseCase.p()); - if ( eclResCase && eclResCase->eclipseCaseData() ) - { - hasFlowDiagFluxes = eclResCase->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->hasFlowDiagUsableFluxes(); - } - RimGridTimeHistoryCurve* timeHistoryCurve; this->firstAncestorOrThisOfType(timeHistoryCurve); // Do not include flow diagnostics results if not available or is a time history curve - if ( !hasFlowDiagFluxes || timeHistoryCurve != nullptr ) + if ( timeHistoryCurve != nullptr ) { using ResCatEnum = caf::AppEnum< RiaDefines::ResultCatType >; for ( size_t i = 0; i < ResCatEnum::size(); ++i ) @@ -720,7 +718,7 @@ RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const } } - return RigFlowDiagResultAddress(m_resultVariable().toStdString(), selTracerNames); + return RigFlowDiagResultAddress(m_resultVariable().toStdString(), m_phaseSelection(), selTracerNames); } //-------------------------------------------------------------------------------------------------- @@ -993,8 +991,8 @@ bool RimEclipseResultDefinition::hasDualPorFractureResult() { if ( m_eclipseCase && m_eclipseCase->eclipseCaseData() - && m_eclipseCase->eclipseCaseData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS) - && m_eclipseCase->eclipseCaseData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->reservoirActiveCellCount() > 0 ) + && m_eclipseCase->eclipseCaseData()->activeCellInfo(RiaDefines::FRACTURE_MODEL) + && m_eclipseCase->eclipseCaseData()->activeCellInfo(RiaDefines::FRACTURE_MODEL)->reservoirActiveCellCount() > 0 ) { return true; } @@ -1027,6 +1025,8 @@ void RimEclipseResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm uiOrdering.add(&m_selectedTracersUiField); } + uiOrdering.add(&m_phaseSelection); + if ( m_flowSolution() == nullptr ) { assignFlowSolutionFromCase(); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h index 5eb61ed8bf..843f9a4ed6 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h @@ -21,6 +21,9 @@ #pragma once #include "RiaDefines.h" +#include "RiaPorosityModel.h" + +#include "RigFlowDiagResultAddress.h" #include "cafAppEnum.h" #include "cafPdmField.h" @@ -33,7 +36,6 @@ class RimEclipseCase; class RimEclipseView; class RimReservoirCellResultsStorage; class RimFlowDiagSolution; -class RigFlowDiagResultAddress; //================================================================================================== @@ -124,6 +126,7 @@ protected: caf::PdmField< caf::AppEnum< FlowTracerSelectionType > > m_flowTracerSelectionMode; caf::PdmPtrField m_flowSolutionUiField; + caf::PdmField< RigFlowDiagResultAddress::PhaseSelectionEnum > m_phaseSelection; caf::PdmField m_selectedTracersUiFieldFilter; caf::PdmField > m_selectedTracersUiField; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCase.cpp index ed8a9308e5..6d0b188d88 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCase.cpp @@ -159,8 +159,8 @@ bool RimEclipseStatisticsCase::openEclipseGridFile() eclipseCase->setMainGrid(mainGrid); - eclipseCase->setActiveCellInfo(RifReaderInterface::MATRIX_RESULTS, gridCaseGroup->unionOfActiveCells(RifReaderInterface::MATRIX_RESULTS)); - eclipseCase->setActiveCellInfo(RifReaderInterface::FRACTURE_RESULTS, gridCaseGroup->unionOfActiveCells(RifReaderInterface::FRACTURE_RESULTS)); + eclipseCase->setActiveCellInfo(RiaDefines::MATRIX_MODEL, gridCaseGroup->unionOfActiveCells(RiaDefines::MATRIX_MODEL)); + eclipseCase->setActiveCellInfo(RiaDefines::FRACTURE_MODEL, gridCaseGroup->unionOfActiveCells(RiaDefines::FRACTURE_MODEL)); this->setReservoirData( eclipseCase.p() ); @@ -218,15 +218,15 @@ void RimEclipseStatisticsCase::computeStatistics() getSourceCases(sourceCases); if (sourceCases.size() == 0 - || !sourceCases.at(0)->results(RifReaderInterface::MATRIX_RESULTS) - || !sourceCases.at(0)->results(RifReaderInterface::MATRIX_RESULTS)->cellResults()) + || !sourceCases.at(0)->results(RiaDefines::MATRIX_MODEL) + || !sourceCases.at(0)->results(RiaDefines::MATRIX_MODEL)->cellResults()) { return; } // The first source has been read completely from disk, and contains grid and meta data // Use this information for all cases in the case group - size_t timeStepCount = sourceCases.at(0)->results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->maxTimeStepCount(); + size_t timeStepCount = sourceCases.at(0)->results(RiaDefines::MATRIX_MODEL)->cellResults()->maxTimeStepCount(); RimStatisticsConfig statisticsConfig; @@ -248,42 +248,42 @@ void RimEclipseStatisticsCase::computeStatistics() for(size_t pIdx = 0; pIdx < m_selectedDynamicProperties().size(); ++pIdx) { - resultSpecification.append(RimEclipseStatisticsCaseEvaluator::ResSpec(RifReaderInterface::MATRIX_RESULTS, RiaDefines::DYNAMIC_NATIVE, m_selectedDynamicProperties()[pIdx])); + resultSpecification.append(RimEclipseStatisticsCaseEvaluator::ResSpec(RiaDefines::MATRIX_MODEL, RiaDefines::DYNAMIC_NATIVE, m_selectedDynamicProperties()[pIdx])); } for(size_t pIdx = 0; pIdx < m_selectedStaticProperties().size(); ++pIdx) { - resultSpecification.append(RimEclipseStatisticsCaseEvaluator::ResSpec(RifReaderInterface::MATRIX_RESULTS, RiaDefines::STATIC_NATIVE, m_selectedStaticProperties()[pIdx])); + resultSpecification.append(RimEclipseStatisticsCaseEvaluator::ResSpec(RiaDefines::MATRIX_MODEL, RiaDefines::STATIC_NATIVE, m_selectedStaticProperties()[pIdx])); } for(size_t pIdx = 0; pIdx < m_selectedGeneratedProperties().size(); ++pIdx) { - resultSpecification.append(RimEclipseStatisticsCaseEvaluator::ResSpec(RifReaderInterface::MATRIX_RESULTS, RiaDefines::GENERATED, m_selectedGeneratedProperties()[pIdx])); + resultSpecification.append(RimEclipseStatisticsCaseEvaluator::ResSpec(RiaDefines::MATRIX_MODEL, RiaDefines::GENERATED, m_selectedGeneratedProperties()[pIdx])); } for(size_t pIdx = 0; pIdx < m_selectedInputProperties().size(); ++pIdx) { - resultSpecification.append(RimEclipseStatisticsCaseEvaluator::ResSpec(RifReaderInterface::MATRIX_RESULTS, RiaDefines::INPUT_PROPERTY, m_selectedInputProperties()[pIdx])); + resultSpecification.append(RimEclipseStatisticsCaseEvaluator::ResSpec(RiaDefines::MATRIX_MODEL, RiaDefines::INPUT_PROPERTY, m_selectedInputProperties()[pIdx])); } for(size_t pIdx = 0; pIdx < m_selectedFractureDynamicProperties().size(); ++pIdx) { - resultSpecification.append(RimEclipseStatisticsCaseEvaluator::ResSpec(RifReaderInterface::FRACTURE_RESULTS, RiaDefines::DYNAMIC_NATIVE, m_selectedFractureDynamicProperties()[pIdx])); + resultSpecification.append(RimEclipseStatisticsCaseEvaluator::ResSpec(RiaDefines::FRACTURE_MODEL, RiaDefines::DYNAMIC_NATIVE, m_selectedFractureDynamicProperties()[pIdx])); } for(size_t pIdx = 0; pIdx < m_selectedFractureStaticProperties().size(); ++pIdx) { - resultSpecification.append(RimEclipseStatisticsCaseEvaluator::ResSpec(RifReaderInterface::FRACTURE_RESULTS, RiaDefines::STATIC_NATIVE, m_selectedFractureStaticProperties()[pIdx])); + resultSpecification.append(RimEclipseStatisticsCaseEvaluator::ResSpec(RiaDefines::FRACTURE_MODEL, RiaDefines::STATIC_NATIVE, m_selectedFractureStaticProperties()[pIdx])); } for(size_t pIdx = 0; pIdx < m_selectedFractureGeneratedProperties().size(); ++pIdx) { - resultSpecification.append(RimEclipseStatisticsCaseEvaluator::ResSpec(RifReaderInterface::FRACTURE_RESULTS, RiaDefines::GENERATED, m_selectedFractureGeneratedProperties()[pIdx])); + resultSpecification.append(RimEclipseStatisticsCaseEvaluator::ResSpec(RiaDefines::FRACTURE_MODEL, RiaDefines::GENERATED, m_selectedFractureGeneratedProperties()[pIdx])); } for(size_t pIdx = 0; pIdx < m_selectedFractureInputProperties().size(); ++pIdx) { - resultSpecification.append(RimEclipseStatisticsCaseEvaluator::ResSpec(RifReaderInterface::FRACTURE_RESULTS, RiaDefines::INPUT_PROPERTY, m_selectedFractureInputProperties()[pIdx])); + resultSpecification.append(RimEclipseStatisticsCaseEvaluator::ResSpec(RiaDefines::FRACTURE_MODEL, RiaDefines::INPUT_PROPERTY, m_selectedFractureInputProperties()[pIdx])); } RimEclipseStatisticsCaseEvaluator stat(sourceCases, timeStepIndices, statisticsConfig, resultCase, gridCaseGroup); @@ -420,42 +420,42 @@ QList RimEclipseStatisticsCase::calculateValueOptions(co if (&m_selectedDynamicProperties == fieldNeedingOptions) { - QStringList varList = caseData->results(RifReaderInterface::MATRIX_RESULTS)->resultNames(RiaDefines::DYNAMIC_NATIVE); + QStringList varList = caseData->results(RiaDefines::MATRIX_MODEL)->resultNames(RiaDefines::DYNAMIC_NATIVE); return toOptionList(varList); } else if (&m_selectedStaticProperties == fieldNeedingOptions) { - QStringList varList = caseData->results(RifReaderInterface::MATRIX_RESULTS)->resultNames(RiaDefines::STATIC_NATIVE); + QStringList varList = caseData->results(RiaDefines::MATRIX_MODEL)->resultNames(RiaDefines::STATIC_NATIVE); return toOptionList(varList); } else if (&m_selectedGeneratedProperties == fieldNeedingOptions) { - QStringList varList = caseData->results(RifReaderInterface::MATRIX_RESULTS)->resultNames(RiaDefines::GENERATED); + QStringList varList = caseData->results(RiaDefines::MATRIX_MODEL)->resultNames(RiaDefines::GENERATED); return toOptionList(varList); } else if (&m_selectedInputProperties == fieldNeedingOptions) { - QStringList varList = caseData->results(RifReaderInterface::MATRIX_RESULTS)->resultNames(RiaDefines::INPUT_PROPERTY); + QStringList varList = caseData->results(RiaDefines::MATRIX_MODEL)->resultNames(RiaDefines::INPUT_PROPERTY); return toOptionList(varList); } else if (&m_selectedFractureDynamicProperties == fieldNeedingOptions) { - QStringList varList = caseData->results(RifReaderInterface::FRACTURE_RESULTS)->resultNames(RiaDefines::DYNAMIC_NATIVE); + QStringList varList = caseData->results(RiaDefines::FRACTURE_MODEL)->resultNames(RiaDefines::DYNAMIC_NATIVE); return toOptionList(varList); } else if (&m_selectedFractureStaticProperties == fieldNeedingOptions) { - QStringList varList = caseData->results(RifReaderInterface::FRACTURE_RESULTS)->resultNames(RiaDefines::STATIC_NATIVE); + QStringList varList = caseData->results(RiaDefines::FRACTURE_MODEL)->resultNames(RiaDefines::STATIC_NATIVE); return toOptionList(varList); } else if (&m_selectedFractureGeneratedProperties == fieldNeedingOptions) { - QStringList varList = caseData->results(RifReaderInterface::FRACTURE_RESULTS)->resultNames(RiaDefines::GENERATED); + QStringList varList = caseData->results(RiaDefines::FRACTURE_MODEL)->resultNames(RiaDefines::GENERATED); return toOptionList(varList); } else if (&m_selectedFractureInputProperties == fieldNeedingOptions) { - QStringList varList = caseData->results(RifReaderInterface::FRACTURE_RESULTS)->resultNames(RiaDefines::INPUT_PROPERTY); + QStringList varList = caseData->results(RiaDefines::FRACTURE_MODEL)->resultNames(RiaDefines::INPUT_PROPERTY); return toOptionList(varList); } @@ -636,7 +636,7 @@ void RimEclipseStatisticsCase::updateSelectionListVisibilities() { bool isLocked = hasComputedStatistics(); m_resultType.uiCapability()->setUiHidden(isLocked); - m_porosityModel.uiCapability()->setUiHidden(isLocked ); // || !caseGroup()->mainCase()->reservoirData()->results(RifReaderInterface::FRACTURE_RESULTS)->resultCount() + m_porosityModel.uiCapability()->setUiHidden(isLocked ); // || !caseGroup()->mainCase()->reservoirData()->results(RiaDefines::FRACTURE_MODEL)->resultCount() m_selectedDynamicProperties.uiCapability()->setUiHidden( isLocked || !(m_porosityModel() == RiaDefines::MATRIX_MODEL && m_resultType() == RiaDefines::DYNAMIC_NATIVE)); m_selectedStaticProperties.uiCapability()->setUiHidden( isLocked || !(m_porosityModel() == RiaDefines::MATRIX_MODEL && m_resultType() == RiaDefines::STATIC_NATIVE)); @@ -668,8 +668,8 @@ void RimEclipseStatisticsCase::updatePercentileUiVisibility() bool RimEclipseStatisticsCase::hasComputedStatistics() const { if ( eclipseCaseData() - && ( eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->resultCount() - || eclipseCaseData()->results(RifReaderInterface::FRACTURE_RESULTS)->resultCount())) + && ( eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->resultCount() + || eclipseCaseData()->results(RiaDefines::FRACTURE_MODEL)->resultCount())) { return true; } @@ -707,14 +707,14 @@ void RimEclipseStatisticsCase::updateConnectedEditorsAndReservoirViews() //-------------------------------------------------------------------------------------------------- void RimEclipseStatisticsCase::clearComputedStatistics() { - if (eclipseCaseData() && eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)) + if (eclipseCaseData() && eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)) { - eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->clearAllResults(); + eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->clearAllResults(); } - if (eclipseCaseData() && eclipseCaseData()->results(RifReaderInterface::FRACTURE_RESULTS)) + if (eclipseCaseData() && eclipseCaseData()->results(RiaDefines::FRACTURE_MODEL)) { - eclipseCaseData()->results(RifReaderInterface::FRACTURE_RESULTS)->clearAllResults(); + eclipseCaseData()->results(RiaDefines::FRACTURE_MODEL)->clearAllResults(); } updateConnectedEditorsAndReservoirViews(); @@ -750,28 +750,28 @@ void RimEclipseStatisticsCase::populateResultSelection() if (m_selectedDynamicProperties().size() == 0) { - QStringList varList = caseData->results(RifReaderInterface::MATRIX_RESULTS)->resultNames(RiaDefines::DYNAMIC_NATIVE); + QStringList varList = caseData->results(RiaDefines::MATRIX_MODEL)->resultNames(RiaDefines::DYNAMIC_NATIVE); if (varList.contains("SOIL")) m_selectedDynamicProperties.v().push_back("SOIL"); if (varList.contains("PRESSURE")) m_selectedDynamicProperties.v().push_back("PRESSURE"); } if (m_selectedStaticProperties().size() == 0) { - QStringList varList = caseData->results(RifReaderInterface::MATRIX_RESULTS)->resultNames(RiaDefines::STATIC_NATIVE); + QStringList varList = caseData->results(RiaDefines::MATRIX_MODEL)->resultNames(RiaDefines::STATIC_NATIVE); if (varList.contains("PERMX")) m_selectedStaticProperties.v().push_back("PERMX"); if (varList.contains("PORO")) m_selectedStaticProperties.v().push_back("PORO"); } if (m_selectedFractureDynamicProperties().size() == 0) { - QStringList varList = caseData->results(RifReaderInterface::FRACTURE_RESULTS)->resultNames(RiaDefines::DYNAMIC_NATIVE); + QStringList varList = caseData->results(RiaDefines::FRACTURE_MODEL)->resultNames(RiaDefines::DYNAMIC_NATIVE); if (varList.contains("SOIL")) m_selectedFractureDynamicProperties.v().push_back("SOIL"); if (varList.contains("PRESSURE")) m_selectedFractureDynamicProperties.v().push_back("PRESSURE"); } if (m_selectedFractureStaticProperties().size() == 0) { - QStringList varList = caseData->results(RifReaderInterface::FRACTURE_RESULTS)->resultNames(RiaDefines::STATIC_NATIVE); + QStringList varList = caseData->results(RiaDefines::FRACTURE_MODEL)->resultNames(RiaDefines::STATIC_NATIVE); if (varList.contains("PERMX")) m_selectedFractureStaticProperties.v().push_back("PERMX"); if (varList.contains("PORO")) m_selectedFractureStaticProperties.v().push_back("PORO"); } diff --git a/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCaseEvaluator.cpp b/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCaseEvaluator.cpp index 923ed6f9dd..c7c8ce838b 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCaseEvaluator.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCaseEvaluator.cpp @@ -24,6 +24,7 @@ #include "RigEclipseCaseData.h" #include "RigMainGrid.h" #include "RigResultAccessorFactory.h" +#include "RigEclipseResultInfo.h" #include "RigResultModifier.h" #include "RigResultModifierFactory.h" #include "RigStatisticsMath.h" @@ -43,20 +44,18 @@ void RimEclipseStatisticsCaseEvaluator::addNamedResult(RigCaseCellResultsData* d // Use time step dates from first result in first source case CVF_ASSERT(m_sourceCases.size() > 0); - std::vector sourceTimeStepDates = m_sourceCases[0]->results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->timeStepDates(0); - std::vector sourceDaysSinceSimulationStart = m_sourceCases[0]->results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->daysSinceSimulationStart(0); - std::vector sourceReportStepNumbers = m_sourceCases[0]->results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->reportStepNumbers(0); + std::vector sourceTimeStepInfos = m_sourceCases[0]->results(RiaDefines::MATRIX_MODEL)->cellResults()->timeStepInfos(0); size_t destinationScalarResultIndex = destinationCellResults->addEmptyScalarResult(resultType, resultName, true); CVF_ASSERT(destinationScalarResultIndex != cvf::UNDEFINED_SIZE_T); - destinationCellResults->setTimeStepDates(destinationScalarResultIndex, sourceTimeStepDates, sourceDaysSinceSimulationStart, sourceReportStepNumbers); + destinationCellResults->setTimeStepInfos(destinationScalarResultIndex, sourceTimeStepInfos); std::vector< std::vector >& dataValues = destinationCellResults->cellScalarResults(destinationScalarResultIndex); - dataValues.resize(sourceTimeStepDates.size()); + dataValues.resize(sourceTimeStepInfos.size()); // Initializes the size of the destination dataset to active union cell count - for (size_t i = 0; i < sourceTimeStepDates.size(); i++) + for (size_t i = 0; i < sourceTimeStepInfos.size(); i++) { dataValues[i].resize(activeUnionCellCount, HUGE_VAL); } @@ -83,7 +82,7 @@ void RimEclipseStatisticsCaseEvaluator::evaluateForResults(const QList& for (int i = 0; i < resultSpecification.size(); i++) { - RifReaderInterface::PorosityModelResultType poroModel = resultSpecification[i].m_poroModel; + RiaDefines::PorosityModelType poroModel = resultSpecification[i].m_poroModel; RiaDefines::ResultCatType resultType = resultSpecification[i].m_resType; QString resultName = resultSpecification[i].m_resVarName; @@ -134,7 +133,7 @@ void RimEclipseStatisticsCaseEvaluator::evaluateForResults(const QList& for (int resSpecIdx = 0; resSpecIdx < resultSpecification.size(); resSpecIdx++) { - RifReaderInterface::PorosityModelResultType poroModel = resultSpecification[resSpecIdx].m_poroModel; + RiaDefines::PorosityModelType poroModel = resultSpecification[resSpecIdx].m_poroModel; RiaDefines::ResultCatType resultType = resultSpecification[resSpecIdx].m_resType; QString resultName = resultSpecification[resSpecIdx].m_resVarName; @@ -302,13 +301,13 @@ void RimEclipseStatisticsCaseEvaluator::evaluateForResults(const QList& if (!eclipseCase->reservoirViews.size()) { - eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->freeAllocatedResultsData(); - eclipseCase->results(RifReaderInterface::FRACTURE_RESULTS)->cellResults()->freeAllocatedResultsData(); + eclipseCase->results(RiaDefines::MATRIX_MODEL)->cellResults()->freeAllocatedResultsData(); + eclipseCase->results(RiaDefines::FRACTURE_MODEL)->cellResults()->freeAllocatedResultsData(); } // Todo : These calls really do nothing right now the access actually closes automatically in ert i belive ... - eclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->readerInterface()->close(); - eclipseCase->results(RifReaderInterface::FRACTURE_RESULTS)->readerInterface()->close(); + eclipseCase->results(RiaDefines::MATRIX_MODEL)->readerInterface()->close(); + eclipseCase->results(RiaDefines::FRACTURE_MODEL)->readerInterface()->close(); } progressInfo.setProgress(timeIndicesIdx); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCaseEvaluator.h b/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCaseEvaluator.h index 7d35aee1a4..5241c33898 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCaseEvaluator.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCaseEvaluator.h @@ -64,12 +64,12 @@ public: struct ResSpec { - ResSpec() : m_resType(RiaDefines::DYNAMIC_NATIVE), m_poroModel(RifReaderInterface::MATRIX_RESULTS) {} - ResSpec( RifReaderInterface::PorosityModelResultType poroModel, + ResSpec() : m_resType(RiaDefines::DYNAMIC_NATIVE), m_poroModel(RiaDefines::MATRIX_MODEL) {} + ResSpec( RiaDefines::PorosityModelType poroModel, RiaDefines::ResultCatType resType, QString resVarName) : m_poroModel(poroModel), m_resType(resType), m_resVarName(resVarName) {} - RifReaderInterface::PorosityModelResultType m_poroModel; + RiaDefines::PorosityModelType m_poroModel; RiaDefines::ResultCatType m_resType; QString m_resVarName; }; @@ -80,7 +80,7 @@ public: private: void addNamedResult(RigCaseCellResultsData* cellResults, RiaDefines::ResultCatType resultType, const QString& resultName, size_t activeCellCount); - void buildSourceMetaData(RifReaderInterface::PorosityModelResultType poroModel, RiaDefines::ResultCatType resultType, const QString& resultName); + void buildSourceMetaData(RiaDefines::PorosityModelType poroModel, RiaDefines::ResultCatType resultType, const QString& resultName); enum StatisticsParamType { MIN, MAX, SUM, RANGE, MEAN, STDEV, PMIN, PMID, PMAX, STAT_PARAM_COUNT }; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp index b913fcc20b..868c4e18fe 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp @@ -879,9 +879,7 @@ RimReservoirCellResultsStorage* RimEclipseView::currentGridCellResults() { if (m_eclipseCase) { - RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResult->porosityModel()); - - return m_eclipseCase->results(porosityModel); + return m_eclipseCase->results(cellResult->porosityModel()); } return NULL; @@ -896,9 +894,7 @@ RigActiveCellInfo* RimEclipseView::currentActiveCellInfo() m_eclipseCase->eclipseCaseData() ) { - RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResult->porosityModel()); - - return m_eclipseCase->eclipseCaseData()->activeCellInfo(porosityModel); + return m_eclipseCase->eclipseCaseData()->activeCellInfo(cellResult->porosityModel()); } return NULL; @@ -983,8 +979,7 @@ void RimEclipseView::updateLegends() RigEclipseCaseData* eclipseCase = m_eclipseCase->eclipseCaseData(); CVF_ASSERT(eclipseCase); - RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResult()->porosityModel()); - RigCaseCellResultsData* results = eclipseCase->results(porosityModel); + RigCaseCellResultsData* results = eclipseCase->results(cellResult()->porosityModel()); CVF_ASSERT(results); updateMinMaxValuesAndAddLegendToView(QString("Cell Results: \n"), this->cellResult(), results); diff --git a/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp b/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp index e91aac25f8..da89a633c8 100644 --- a/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp +++ b/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp @@ -22,10 +22,10 @@ #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" -#include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" #include "RigGridManager.h" #include "RigMainGrid.h" +#include "RigEclipseResultInfo.h" #include "RimCaseCollection.h" #include "RimCellEdgeColors.h" @@ -184,7 +184,7 @@ void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo() RigEclipseCaseData* rigCaseData = mainCase->eclipseCaseData(); CVF_ASSERT(rigCaseData); - RifReaderInterface::PorosityModelResultType poroModel = RifReaderInterface::MATRIX_RESULTS; + RiaDefines::PorosityModelType poroModel = RiaDefines::MATRIX_MODEL; mainCase->results(poroModel)->cellResults()->createPlaceholderResultEntries(); @@ -217,8 +217,8 @@ void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo() RimEclipseCase* rimReservoir = statisticsCaseCollection()->reservoirs[i]; // Check if any results are stored in cache - if (rimReservoir->results(RifReaderInterface::MATRIX_RESULTS)->storedResultsCount() > 0 || - rimReservoir->results(RifReaderInterface::FRACTURE_RESULTS)->storedResultsCount() > 0) + if (rimReservoir->results(RiaDefines::MATRIX_MODEL)->storedResultsCount() > 0 || + rimReservoir->results(RiaDefines::FRACTURE_MODEL)->storedResultsCount() > 0) { foundResultsInCache = true; break; @@ -236,13 +236,11 @@ void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo() // for all cases { - RifReaderInterface::PorosityModelResultType poroModel = RifReaderInterface::MATRIX_RESULTS; + RiaDefines::PorosityModelType poroModel = RiaDefines::MATRIX_MODEL; - std::vector timeStepDates = rigCaseData->results(poroModel)->timeStepDates(0); - std::vector daysSinceSimulationStart = rigCaseData->results(poroModel)->daysSinceSimulationStart(0); - std::vector reportStepNumbers = rigCaseData->results(poroModel)->reportStepNumbers(0); + std::vector timeStepInfos = rigCaseData->results(poroModel)->timeStepInfos(0); - const std::vector resultInfos = rigCaseData->results(poroModel)->infoForEachResultIndex(); + const std::vector resultInfos = rigCaseData->results(poroModel)->infoForEachResultIndex(); for (size_t i = 1; i < caseCollection()->reservoirs.size(); i++) { @@ -265,10 +263,10 @@ void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo() if (mustBeCalculated) cellResultsStorage->cellResults()->setMustBeCalculated(scalarResultIndex); - cellResultsStorage->cellResults()->setTimeStepDates(scalarResultIndex, timeStepDates, daysSinceSimulationStart, reportStepNumbers); + cellResultsStorage->cellResults()->setTimeStepInfos(scalarResultIndex, timeStepInfos); std::vector< std::vector >& dataValues = cellResultsStorage->cellResults()->cellScalarResults(scalarResultIndex); - dataValues.resize(timeStepDates.size()); + dataValues.resize(timeStepInfos.size()); } } @@ -332,7 +330,7 @@ void RimIdenticalGridCaseGroup::computeUnionOfActiveCells() if (activeM[gridLocalCellIndex] == 0) { - if (caseCollection->reservoirs[caseIdx]->eclipseCaseData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->isActive(reservoirCellIndex)) + if (caseCollection->reservoirs[caseIdx]->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL)->isActive(reservoirCellIndex)) { activeM[gridLocalCellIndex] = 1; } @@ -340,7 +338,7 @@ void RimIdenticalGridCaseGroup::computeUnionOfActiveCells() if (activeF[gridLocalCellIndex] == 0) { - if (caseCollection->reservoirs[caseIdx]->eclipseCaseData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->isActive(reservoirCellIndex)) + if (caseCollection->reservoirs[caseIdx]->eclipseCaseData()->activeCellInfo(RiaDefines::FRACTURE_MODEL)->isActive(reservoirCellIndex)) { activeF[gridLocalCellIndex] = 1; } @@ -424,13 +422,13 @@ void RimIdenticalGridCaseGroup::clearStatisticsResults() RimEclipseCase* rimStaticsCase = statisticsCaseCollection->reservoirs[i]; if (!rimStaticsCase) continue; - if (rimStaticsCase->results(RifReaderInterface::MATRIX_RESULTS)->cellResults()) + if (rimStaticsCase->results(RiaDefines::MATRIX_MODEL)->cellResults()) { - rimStaticsCase->results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->clearAllResults(); + rimStaticsCase->results(RiaDefines::MATRIX_MODEL)->cellResults()->clearAllResults(); } - if (rimStaticsCase->results(RifReaderInterface::FRACTURE_RESULTS)->cellResults()) + if (rimStaticsCase->results(RiaDefines::FRACTURE_MODEL)->cellResults()) { - rimStaticsCase->results(RifReaderInterface::FRACTURE_RESULTS)->cellResults()->clearAllResults(); + rimStaticsCase->results(RiaDefines::FRACTURE_MODEL)->cellResults()->clearAllResults(); } for (size_t j = 0; j < rimStaticsCase->reservoirViews.size(); j++) @@ -474,9 +472,9 @@ bool RimIdenticalGridCaseGroup::contains(RimEclipseCase* reservoir) const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RigActiveCellInfo* RimIdenticalGridCaseGroup::unionOfActiveCells(RifReaderInterface::PorosityModelResultType porosityType) +RigActiveCellInfo* RimIdenticalGridCaseGroup::unionOfActiveCells(RiaDefines::PorosityModelType porosityType) { - if (porosityType == RifReaderInterface::MATRIX_RESULTS) + if (porosityType == RiaDefines::MATRIX_MODEL) { return m_unionOfMatrixActiveCells.p(); } diff --git a/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.h b/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.h index 068ac935de..2486729a64 100644 --- a/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.h +++ b/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.h @@ -68,7 +68,7 @@ public: RigMainGrid* mainGrid(); - RigActiveCellInfo* unionOfActiveCells(RifReaderInterface::PorosityModelResultType porosityType); + RigActiveCellInfo* unionOfActiveCells(RiaDefines::PorosityModelType porosityType); void computeUnionOfActiveCells(); static bool isStatisticsCaseCollection(RimCaseCollection* rimCaseCollection); diff --git a/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp b/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp index 75cdce6b9d..9a9cb76dcd 100644 --- a/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp +++ b/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp @@ -21,9 +21,10 @@ #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" -#include "RigEclipseCaseData.h" #include "RigCell.h" +#include "RigEclipseCaseData.h" #include "RigMainGrid.h" +#include "RigEclipseResultInfo.h" #include "RimEclipseCase.h" #include "RimTools.h" @@ -90,7 +91,7 @@ void RimReservoirCellResultsStorage::setupBeforeSave() if (!m_cellResults) return; - const std::vector& resInfo = m_cellResults->infoForEachResultIndex(); + const std::vector& resInfo = m_cellResults->infoForEachResultIndex(); bool hasResultsToStore = false; for (size_t rIdx = 0; rIdx < resInfo.size(); ++rIdx) @@ -139,15 +140,15 @@ void RimReservoirCellResultsStorage::setupBeforeSave() cacheEntry->m_resultType = resInfo[rIdx].m_resultType; cacheEntry->m_resultName = resInfo[rIdx].m_resultName; - cacheEntry->m_timeStepDates = resInfo[rIdx].m_timeStepDates; - cacheEntry->m_daysSinceSimulationStart = resInfo[rIdx].m_daysSinceSimulationStart; + cacheEntry->m_timeStepDates = resInfo[rIdx].dates(); + cacheEntry->m_daysSinceSimulationStart = resInfo[rIdx].daysSinceSimulationStarts(); // Take note of the file position for fast lookup later cacheEntry->m_filePosition = cacheFile.pos(); // Write all the scalar values for each time step to the stream, // starting with the number of values - for (size_t tsIdx = 0; tsIdx < resInfo[rIdx].m_timeStepDates.size() ; ++tsIdx) + for (size_t tsIdx = 0; tsIdx < resInfo[rIdx].dates().size() ; ++tsIdx) { const std::vector* data = NULL; if (tsIdx < timestepCount) @@ -380,7 +381,7 @@ size_t RimReservoirCellResultsStorage::findOrLoadScalarResult(RiaDefines::Result if (m_readerInterface.notNull()) { // Add one more result to result container - size_t timeStepCount = m_cellResults->infoForEachResultIndex()[scalarResultIndex].m_timeStepDates.size(); + size_t timeStepCount = m_cellResults->infoForEachResultIndex()[scalarResultIndex].m_timeStepInfos.size(); bool resultLoadingSucess = true; @@ -392,7 +393,7 @@ size_t RimReservoirCellResultsStorage::findOrLoadScalarResult(RiaDefines::Result for (i = 0; i < timeStepCount; i++) { std::vector& values = m_cellResults->cellScalarResults(scalarResultIndex)[i]; - if (!m_readerInterface->dynamicResult(resultName, RifReaderInterface::MATRIX_RESULTS, i, &values)) + if (!m_readerInterface->dynamicResult(resultName, RiaDefines::MATRIX_MODEL, i, &values)) { resultLoadingSucess = false; } @@ -403,7 +404,7 @@ size_t RimReservoirCellResultsStorage::findOrLoadScalarResult(RiaDefines::Result m_cellResults->cellScalarResults(scalarResultIndex).resize(1); std::vector& values = m_cellResults->cellScalarResults(scalarResultIndex)[0]; - if (!m_readerInterface->staticResult(resultName, RifReaderInterface::MATRIX_RESULTS, &values)) + if (!m_readerInterface->staticResult(resultName, RiaDefines::MATRIX_MODEL, &values)) { resultLoadingSucess = false; } @@ -462,7 +463,7 @@ size_t RimReservoirCellResultsStorage::findOrLoadScalarResultForTimeStep(RiaDefi if (m_readerInterface.notNull()) { - size_t timeStepCount = m_cellResults->infoForEachResultIndex()[scalarResultIndex].m_timeStepDates.size(); + size_t timeStepCount = m_cellResults->infoForEachResultIndex()[scalarResultIndex].m_timeStepInfos.size(); bool resultLoadingSucess = true; @@ -473,7 +474,7 @@ size_t RimReservoirCellResultsStorage::findOrLoadScalarResultForTimeStep(RiaDefi std::vector& values = m_cellResults->cellScalarResults(scalarResultIndex)[timeStepIndex]; if (values.size() == 0) { - if (!m_readerInterface->dynamicResult(resultName, RifReaderInterface::MATRIX_RESULTS, timeStepIndex, &values)) + if (!m_readerInterface->dynamicResult(resultName, RiaDefines::MATRIX_MODEL, timeStepIndex, &values)) { resultLoadingSucess = false; } @@ -484,7 +485,7 @@ size_t RimReservoirCellResultsStorage::findOrLoadScalarResultForTimeStep(RiaDefi m_cellResults->cellScalarResults(scalarResultIndex).resize(1); std::vector& values = m_cellResults->cellScalarResults(scalarResultIndex)[0]; - if (!m_readerInterface->staticResult(resultName, RifReaderInterface::MATRIX_RESULTS, &values)) + if (!m_readerInterface->staticResult(resultName, RiaDefines::MATRIX_MODEL, &values)) { resultLoadingSucess = false; } @@ -526,7 +527,7 @@ void RimReservoirCellResultsStorage::computeSOILForTimeStep(size_t timeStepIndex if (swatForTimeStep.size() > 0) { soilResultValueCount = swatForTimeStep.size(); - soilTimeStepCount = m_cellResults->infoForEachResultIndex()[scalarIndexSWAT].m_timeStepDates.size(); + soilTimeStepCount = m_cellResults->infoForEachResultIndex()[scalarIndexSWAT].m_timeStepInfos.size(); } } @@ -537,7 +538,7 @@ void RimReservoirCellResultsStorage::computeSOILForTimeStep(size_t timeStepIndex { soilResultValueCount = qMax(soilResultValueCount, sgasForTimeStep.size()); - size_t sgasTimeStepCount = m_cellResults->infoForEachResultIndex()[scalarIndexSGAS].m_timeStepDates.size(); + size_t sgasTimeStepCount = m_cellResults->infoForEachResultIndex()[scalarIndexSGAS].m_timeStepInfos.size(); soilTimeStepCount = qMax(soilTimeStepCount, sgasTimeStepCount); } } @@ -1495,7 +1496,11 @@ void RimReservoirCellResultsStorage::setCellResults(RigCaseCellResultsData* cell RimReservoirCellResultsStorageEntryInfo* resInfo = m_resultCacheMetaData[rIdx]; size_t resultIndex = m_cellResults->addEmptyScalarResult(resInfo->m_resultType(), resInfo->m_resultName(), true); - m_cellResults->setTimeStepDates(resultIndex, resInfo->m_timeStepDates(), resInfo->m_daysSinceSimulationStart(), std::vector()); // Hack: Using no report step numbers. Not really used except for Flow Diagnostics... + std::vector reportNumbers; // Hack: Using no report step numbers. Not really used except for Flow Diagnostics... + reportNumbers.resize(resInfo->m_timeStepDates().size()); + std::vector timeStepInfos = RigEclipseTimeStepInfo::createTimeStepInfos(resInfo->m_timeStepDates(), reportNumbers, resInfo->m_daysSinceSimulationStart()); + + m_cellResults->setTimeStepInfos(resultIndex, timeStepInfos); progress.setProgressDescription(resInfo->m_resultName); diff --git a/ApplicationCode/ProjectDataModel/RimTimeStepFilter.cpp b/ApplicationCode/ProjectDataModel/RimTimeStepFilter.cpp new file mode 100644 index 0000000000..1d176929cd --- /dev/null +++ b/ApplicationCode/ProjectDataModel/RimTimeStepFilter.cpp @@ -0,0 +1,47 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimTimeStepFilter.h" + +CAF_PDM_SOURCE_INIT(RimTimeStepFilter, "TimeStepFilter"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimTimeStepFilter::RimTimeStepFilter() +{ + CAF_PDM_InitObject("Time Step Filter", "", "", ""); + + CAF_PDM_InitFieldNoDefault(&m_timeStepIndicesToImport, "TimeStepIndicesToImport", "Values", "", "", ""); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimTimeStepFilter::timeStepIndicesToImport() const +{ + std::vector indices; + + // Convert vector from int to size_t + for (auto intValue : m_timeStepIndicesToImport.v()) + { + indices.push_back(intValue); + } + + return indices; +} diff --git a/ApplicationCode/ProjectDataModel/RimTimeStepFilter.h b/ApplicationCode/ProjectDataModel/RimTimeStepFilter.h new file mode 100644 index 0000000000..12830b44b9 --- /dev/null +++ b/ApplicationCode/ProjectDataModel/RimTimeStepFilter.h @@ -0,0 +1,40 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafPdmObject.h" +#include "cafPdmField.h" + +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +class RimTimeStepFilter : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; +public: + RimTimeStepFilter(); + + std::vector timeStepIndicesToImport() const; + +private: + caf::PdmField< std::vector > m_timeStepIndicesToImport; +}; + diff --git a/ApplicationCode/ProjectDataModel/RimView.cpp b/ApplicationCode/ProjectDataModel/RimView.cpp index 450b69a8ef..f272db7b27 100644 --- a/ApplicationCode/ProjectDataModel/RimView.cpp +++ b/ApplicationCode/ProjectDataModel/RimView.cpp @@ -51,6 +51,8 @@ #include "cvfScene.h" #include "cvfViewport.h" +#include + #include #include "cvfTransform.h" @@ -738,7 +740,7 @@ void RimView::addDynamicWellPathsToModel(cvf::ModelBasicList* wellPathModelBasic QDateTime currentTimeStamp; std::vector timeStamps = ownerCase()->timeStepDates(); - if (currentTimeStep() < timeStamps.size()) + if (currentTimeStep() < static_cast(timeStamps.size())) { currentTimeStamp = timeStamps[currentTimeStep()]; } diff --git a/ApplicationCode/ProjectDataModel/RimViewLinker.h b/ApplicationCode/ProjectDataModel/RimViewLinker.h index 779aa03f76..39df28f97b 100644 --- a/ApplicationCode/ProjectDataModel/RimViewLinker.h +++ b/ApplicationCode/ProjectDataModel/RimViewLinker.h @@ -19,8 +19,6 @@ #pragma once -#include "RiaDefines.h" - #include "RivCellSetEnum.h" #include "cafPdmChildArrayField.h" diff --git a/ApplicationCode/ProjectDataModel/RimViewLinkerCollection.h b/ApplicationCode/ProjectDataModel/RimViewLinkerCollection.h index 9503ea0fc6..11fb5c90c4 100644 --- a/ApplicationCode/ProjectDataModel/RimViewLinkerCollection.h +++ b/ApplicationCode/ProjectDataModel/RimViewLinkerCollection.h @@ -19,7 +19,6 @@ #pragma once -#include "RiaDefines.h" #include "cafPdmChildField.h" #include "cafPdmField.h" diff --git a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp index fd3cdb4ea8..0bf47f0ba3 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp @@ -721,10 +721,9 @@ QString RimWellLogExtractionCurve::createCurveAutoName() if (eclipseCase) { - RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_eclipseResultDefinition->porosityModel()); if (eclipseCase->eclipseCaseData()) { - maxTimeStep = eclipseCase->eclipseCaseData()->results(porosityModel)->maxTimeStepCount(); + maxTimeStep = eclipseCase->eclipseCaseData()->results(m_eclipseResultDefinition->porosityModel())->maxTimeStepCount(); } } else if (geomCase) @@ -826,7 +825,6 @@ QString RimWellLogExtractionCurve::wellDate() const if (eclipseCase) { - RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_eclipseResultDefinition->porosityModel()); if (eclipseCase->eclipseCaseData()) { timeStepNames = eclipseCase->timeStepStrings(); diff --git a/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake b/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake index 201cdcd681..f60a52f563 100644 --- a/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake +++ b/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake @@ -67,6 +67,9 @@ ${CEE_CURRENT_LIST_DIR}RigFractureGrid.h ${CEE_CURRENT_LIST_DIR}RigFractureCell.h ${CEE_CURRENT_LIST_DIR}RigWellPathIntersectionTools.h ${CEE_CURRENT_LIST_DIR}RigTransmissibilityEquations.h +${CEE_CURRENT_LIST_DIR}RigEclipseResultInfo.h +${CEE_CURRENT_LIST_DIR}RigTofAccumulatedPhaseFractionsCalculator.h + ) @@ -128,6 +131,8 @@ ${CEE_CURRENT_LIST_DIR}RigFractureGrid.cpp ${CEE_CURRENT_LIST_DIR}RigFractureCell.cpp ${CEE_CURRENT_LIST_DIR}RigWellPathIntersectionTools.cpp ${CEE_CURRENT_LIST_DIR}RigTransmissibilityEquations.cpp +${CEE_CURRENT_LIST_DIR}RigEclipseResultInfo.cpp +${CEE_CURRENT_LIST_DIR}RigTofAccumulatedPhaseFractionsCalculator.cpp ) diff --git a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp index 69daee7d82..9671e9f3ec 100644 --- a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp @@ -20,13 +20,15 @@ #include "RigCaseCellResultsData.h" -#include "RigMainGrid.h" -#include "RigStatisticsDataCache.h" -#include "RigStatisticsMath.h" #include "RigEclipseMultiPropertyStatCalc.h" #include "RigEclipseNativeStatCalc.h" +#include "RigMainGrid.h" +#include "RigEclipseResultInfo.h" +#include "RigStatisticsDataCache.h" +#include "RigStatisticsMath.h" #include + #include @@ -205,7 +207,7 @@ std::vector& RigCaseCellResultsData::cellScalarResults(size_t scalarResu //-------------------------------------------------------------------------------------------------- size_t RigCaseCellResultsData::findScalarResultIndex(RiaDefines::ResultCatType type, const QString& resultName) const { - std::vector::const_iterator it; + std::vector::const_iterator it; for (it = m_resultInfos.begin(); it != m_resultInfos.end(); ++it) { if (it->m_resultType == type && it->m_resultName == resultName) @@ -266,7 +268,7 @@ size_t RigCaseCellResultsData::addEmptyScalarResult(RiaDefines::ResultCatType ty scalarResultIndex = this->resultCount(); m_cellScalarResults.push_back(std::vector >()); - ResultInfo resInfo(type, needsToBeStored, false, resultName, scalarResultIndex); + RigEclipseResultInfo resInfo(type, needsToBeStored, false, resultName, scalarResultIndex); m_resultInfos.push_back(resInfo); // Create statistics calculator and add statistics cache object @@ -339,7 +341,7 @@ size_t RigCaseCellResultsData::addEmptyScalarResult(RiaDefines::ResultCatType ty QStringList RigCaseCellResultsData::resultNames(RiaDefines::ResultCatType resType) const { QStringList varList; - std::vector::const_iterator it; + std::vector::const_iterator it; for (it = m_resultInfos.begin(); it != m_resultInfos.end(); ++it) { if (it->m_resultType == resType ) @@ -392,8 +394,8 @@ bool RigCaseCellResultsData::hasFlowDiagUsableFluxes() const //-------------------------------------------------------------------------------------------------- QDateTime RigCaseCellResultsData::timeStepDate(size_t scalarResultIndex, size_t timeStepIndex) const { - if (scalarResultIndex < m_resultInfos.size() && m_resultInfos[scalarResultIndex].m_timeStepDates.size() > timeStepIndex) - return m_resultInfos[scalarResultIndex].m_timeStepDates[timeStepIndex]; + if (scalarResultIndex < m_resultInfos.size() && m_resultInfos[scalarResultIndex].m_timeStepInfos.size() > timeStepIndex) + return m_resultInfos[scalarResultIndex].m_timeStepInfos[timeStepIndex].m_date; else return QDateTime(); } @@ -404,7 +406,9 @@ QDateTime RigCaseCellResultsData::timeStepDate(size_t scalarResultIndex, size_t std::vector RigCaseCellResultsData::timeStepDates(size_t scalarResultIndex) const { if (scalarResultIndex < m_resultInfos.size()) - return m_resultInfos[scalarResultIndex].m_timeStepDates; + { + return m_resultInfos[scalarResultIndex].dates(); + } else return std::vector(); } @@ -438,7 +442,7 @@ std::vector RigCaseCellResultsData::daysSinceSimulationStart(size_t scal { if (scalarResultIndex < m_resultInfos.size()) { - return m_resultInfos[scalarResultIndex].m_daysSinceSimulationStart; + return m_resultInfos[scalarResultIndex].daysSinceSimulationStarts(); } else { @@ -451,8 +455,8 @@ std::vector RigCaseCellResultsData::daysSinceSimulationStart(size_t scal //-------------------------------------------------------------------------------------------------- int RigCaseCellResultsData::reportStepNumber(size_t scalarResultIndex, size_t timeStepIndex) const { - if (scalarResultIndex < m_resultInfos.size() && m_resultInfos[scalarResultIndex].m_timeStepReportNumbers.size() > timeStepIndex) - return m_resultInfos[scalarResultIndex].m_timeStepReportNumbers[timeStepIndex]; + if (scalarResultIndex < m_resultInfos.size() && m_resultInfos[scalarResultIndex].m_timeStepInfos.size() > timeStepIndex) + return m_resultInfos[scalarResultIndex].m_timeStepInfos[timeStepIndex].m_reportNumber; else return -1; } @@ -463,25 +467,33 @@ int RigCaseCellResultsData::reportStepNumber(size_t scalarResultIndex, size_t ti std::vector RigCaseCellResultsData::reportStepNumbers(size_t scalarResultIndex) const { if (scalarResultIndex < m_resultInfos.size() ) - return m_resultInfos[scalarResultIndex].m_timeStepReportNumbers; + return m_resultInfos[scalarResultIndex].reportNumbers(); else return std::vector(); - } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigCaseCellResultsData::setTimeStepDates(size_t scalarResultIndex, const std::vector& dates, const std::vector& daysSinceSimulationStart, const std::vector& reportStepNumbers) +std::vector RigCaseCellResultsData::timeStepInfos(size_t scalarResultIndex) const +{ + if (scalarResultIndex < m_resultInfos.size()) + return m_resultInfos[scalarResultIndex].m_timeStepInfos; + else + return std::vector(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigCaseCellResultsData::setTimeStepInfos(size_t scalarResultIndex, const std::vector& timeStepInfos) { CVF_ASSERT(scalarResultIndex < m_resultInfos.size() ); - m_resultInfos[scalarResultIndex].m_timeStepDates = dates; - m_resultInfos[scalarResultIndex].m_daysSinceSimulationStart = daysSinceSimulationStart; - m_resultInfos[scalarResultIndex].m_timeStepReportNumbers = reportStepNumbers; + m_resultInfos[scalarResultIndex].m_timeStepInfos = timeStepInfos; std::vector< std::vector >& dataValues = this->cellScalarResults(scalarResultIndex); - dataValues.resize(dates.size()); + dataValues.resize(timeStepInfos.size()); } //-------------------------------------------------------------------------------------------------- @@ -494,9 +506,9 @@ size_t RigCaseCellResultsData::maxTimeStepCount(size_t* scalarResultIndexWithMos for (size_t i = 0; i < m_resultInfos.size(); i++) { - if (m_resultInfos[i].m_timeStepDates.size() > maxTsCount) + if (m_resultInfos[i].m_timeStepInfos.size() > maxTsCount) { - maxTsCount = m_resultInfos[i].m_timeStepDates.size(); + maxTsCount = m_resultInfos[i].m_timeStepInfos.size(); scalarResultIndexWithMaxTsCount = i; } } @@ -585,16 +597,6 @@ size_t RigCaseCellResultsData::addStaticScalarResult(RiaDefines::ResultCatType t return resultIdx; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RifReaderInterface::PorosityModelResultType RigCaseCellResultsData::convertFromProjectModelPorosityModel(RiaDefines::PorosityModelType porosityModel) -{ - if (porosityModel == RiaDefines::MATRIX_MODEL) return RifReaderInterface::MATRIX_RESULTS; - - return RifReaderInterface::FRACTURE_RESULTS; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -619,7 +621,7 @@ bool RigCaseCellResultsData::updateResultName(RiaDefines::ResultCatType resultTy //-------------------------------------------------------------------------------------------------- bool RigCaseCellResultsData::mustBeCalculated(size_t scalarResultIndex) const { - std::vector::const_iterator it; + std::vector::const_iterator it; for (it = m_resultInfos.begin(); it != m_resultInfos.end(); ++it) { if (it->m_gridScalarResultIndex == scalarResultIndex) @@ -636,7 +638,7 @@ bool RigCaseCellResultsData::mustBeCalculated(size_t scalarResultIndex) const //-------------------------------------------------------------------------------------------------- void RigCaseCellResultsData::setMustBeCalculated(size_t scalarResultIndex) { - std::vector::iterator it; + std::vector::iterator it; for (it = m_resultInfos.begin(); it != m_resultInfos.end(); ++it) { if (it->m_gridScalarResultIndex == scalarResultIndex) diff --git a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.h b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.h index 18c5e11b5c..2b36c7d06f 100644 --- a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.h +++ b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.h @@ -32,9 +32,11 @@ #include class RifReaderInterface; -class RigMainGrid; class RigActiveCellInfo; +class RigMainGrid; +class RigEclipseResultInfo; class RigStatisticsDataCache; +class RigEclipseTimeStepInfo; //================================================================================================== /// Class containing the results for the complete number of active cells. Both main grid and LGR's @@ -80,7 +82,9 @@ public: std::vector daysSinceSimulationStart(size_t scalarResultIndex) const; int reportStepNumber(size_t scalarResultIndex, size_t timeStepIndex) const; std::vector reportStepNumbers(size_t scalarResultIndex) const; - void setTimeStepDates(size_t scalarResultIndex, const std::vector& dates, const std::vector& daysSinceSimulationStart, const std::vector& reportStepNumbers); + + std::vector timeStepInfos(size_t scalarResultIndex) const; + void setTimeStepInfos(size_t scalarResultIndex, const std::vector& timeStepInfos); // Find or create a slot for the results @@ -102,29 +106,10 @@ public: std::vector< std::vector > & cellScalarResults(size_t scalarResultIndex); std::vector& cellScalarResults(size_t scalarResultIndex, size_t timeStepIndex); - static RifReaderInterface::PorosityModelResultType convertFromProjectModelPorosityModel(RiaDefines::PorosityModelType porosityModel); - bool updateResultName(RiaDefines::ResultCatType resultType, QString& oldName, const QString& newName); public: - class ResultInfo - { - public: - ResultInfo(RiaDefines::ResultCatType resultType, bool needsToBeStored, bool mustBeCalculated, QString resultName, size_t gridScalarResultIndex) - : m_resultType(resultType), m_needsToBeStored(needsToBeStored), m_resultName(resultName), m_gridScalarResultIndex(gridScalarResultIndex), m_mustBeCalculated(mustBeCalculated) { } - - public: - RiaDefines::ResultCatType m_resultType; - bool m_needsToBeStored; - bool m_mustBeCalculated; - QString m_resultName; - size_t m_gridScalarResultIndex; - std::vector m_timeStepDates; - std::vector m_timeStepReportNumbers; - std::vector m_daysSinceSimulationStart; - }; - - const std::vector& infoForEachResultIndex() { return m_resultInfos;} + const std::vector& infoForEachResultIndex() { return m_resultInfos;} bool mustBeCalculated(size_t scalarResultIndex) const; void setMustBeCalculated(size_t scalarResultIndex); @@ -143,9 +128,8 @@ private: cvf::Collection m_statisticsDataCache; private: - std::vector m_resultInfos; + std::vector m_resultInfos; RigMainGrid* m_ownerMainGrid; RigActiveCellInfo* m_activeCellInfo; - }; diff --git a/ApplicationCode/ReservoirDataModel/RigCompletionData.cpp b/ApplicationCode/ReservoirDataModel/RigCompletionData.cpp index 696c92ac95..ffd4dab613 100644 --- a/ApplicationCode/ReservoirDataModel/RigCompletionData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigCompletionData.cpp @@ -20,7 +20,10 @@ #include "RiaLogging.h" +#include "cvfAssert.h" + #include + #include // Needed for HUGE_VAL on Linux diff --git a/ApplicationCode/ReservoirDataModel/RigCompletionData.h b/ApplicationCode/ReservoirDataModel/RigCompletionData.h index 28cc2109f4..975a8f7a0a 100644 --- a/ApplicationCode/ReservoirDataModel/RigCompletionData.h +++ b/ApplicationCode/ReservoirDataModel/RigCompletionData.h @@ -18,10 +18,8 @@ #pragma once -#include "cvfBase.h" -#include "cvfObject.h" - #include + #include //================================================================================================== @@ -88,7 +86,7 @@ struct RigCompletionMetaData { //================================================================================================== /// //================================================================================================== -class RigCompletionData : public cvf::Object +class RigCompletionData { public: enum CompletionType { diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.cpp b/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.cpp index 909c54b241..6b13d56e89 100644 --- a/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.cpp @@ -434,9 +434,9 @@ void RigEclipseCaseData::computeActiveCellBoundingBoxes() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RigActiveCellInfo* RigEclipseCaseData::activeCellInfo(RifReaderInterface::PorosityModelResultType porosityModel) +RigActiveCellInfo* RigEclipseCaseData::activeCellInfo(RiaDefines::PorosityModelType porosityModel) { - if (porosityModel == RifReaderInterface::MATRIX_RESULTS) + if (porosityModel == RiaDefines::MATRIX_MODEL) { return m_activeCellInfo.p(); } @@ -447,9 +447,9 @@ RigActiveCellInfo* RigEclipseCaseData::activeCellInfo(RifReaderInterface::Porosi //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -const RigActiveCellInfo* RigEclipseCaseData::activeCellInfo(RifReaderInterface::PorosityModelResultType porosityModel) const +const RigActiveCellInfo* RigEclipseCaseData::activeCellInfo(RiaDefines::PorosityModelType porosityModel) const { - if (porosityModel == RifReaderInterface::MATRIX_RESULTS) + if (porosityModel == RiaDefines::MATRIX_MODEL) { return m_activeCellInfo.p(); } @@ -460,9 +460,9 @@ const RigActiveCellInfo* RigEclipseCaseData::activeCellInfo(RifReaderInterface:: //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigEclipseCaseData::setActiveCellInfo(RifReaderInterface::PorosityModelResultType porosityModel, RigActiveCellInfo* activeCellInfo) +void RigEclipseCaseData::setActiveCellInfo(RiaDefines::PorosityModelType porosityModel, RigActiveCellInfo* activeCellInfo) { - if (porosityModel == RifReaderInterface::MATRIX_RESULTS) + if (porosityModel == RiaDefines::MATRIX_MODEL) { m_activeCellInfo = activeCellInfo; m_matrixModelResults->setActiveCellInfo(m_activeCellInfo.p()); @@ -604,9 +604,9 @@ RigFormationNames* RigEclipseCaseData::activeFormationNames() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RigCaseCellResultsData* RigEclipseCaseData::results(RifReaderInterface::PorosityModelResultType porosityModel) +RigCaseCellResultsData* RigEclipseCaseData::results(RiaDefines::PorosityModelType porosityModel) { - if (porosityModel == RifReaderInterface::MATRIX_RESULTS) + if (porosityModel == RiaDefines::MATRIX_MODEL) { return m_matrixModelResults.p(); } @@ -617,9 +617,9 @@ RigCaseCellResultsData* RigEclipseCaseData::results(RifReaderInterface::Porosity //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -const RigCaseCellResultsData* RigEclipseCaseData::results(RifReaderInterface::PorosityModelResultType porosityModel) const +const RigCaseCellResultsData* RigEclipseCaseData::results(RiaDefines::PorosityModelType porosityModel) const { - if (porosityModel == RifReaderInterface::MATRIX_RESULTS) + if (porosityModel == RiaDefines::MATRIX_MODEL) { return m_matrixModelResults.p(); } diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.h b/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.h index f64601acf7..87224e20d4 100644 --- a/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.h +++ b/ApplicationCode/ReservoirDataModel/RigEclipseCaseData.h @@ -64,12 +64,12 @@ public: RigGridBase* grid(size_t index); size_t gridCount() const; - RigCaseCellResultsData* results(RifReaderInterface::PorosityModelResultType porosityModel); - const RigCaseCellResultsData* results(RifReaderInterface::PorosityModelResultType porosityModel) const; + RigCaseCellResultsData* results(RiaDefines::PorosityModelType porosityModel); + const RigCaseCellResultsData* results(RiaDefines::PorosityModelType porosityModel) const; - RigActiveCellInfo* activeCellInfo(RifReaderInterface::PorosityModelResultType porosityModel); - const RigActiveCellInfo* activeCellInfo(RifReaderInterface::PorosityModelResultType porosityModel) const; - void setActiveCellInfo(RifReaderInterface::PorosityModelResultType porosityModel, RigActiveCellInfo* activeCellInfo); + RigActiveCellInfo* activeCellInfo(RiaDefines::PorosityModelType porosityModel); + const RigActiveCellInfo* activeCellInfo(RiaDefines::PorosityModelType porosityModel) const; + void setActiveCellInfo(RiaDefines::PorosityModelType porosityModel, RigActiveCellInfo* activeCellInfo); void setActiveFormationNames(RigFormationNames* activeFormationNames); RigFormationNames* activeFormationNames(); diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseResultInfo.cpp b/ApplicationCode/ReservoirDataModel/RigEclipseResultInfo.cpp new file mode 100644 index 0000000000..249ac41204 --- /dev/null +++ b/ApplicationCode/ReservoirDataModel/RigEclipseResultInfo.cpp @@ -0,0 +1,110 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RigEclipseResultInfo.h" + +#include "cvfAssert.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigEclipseTimeStepInfo::RigEclipseTimeStepInfo(const QDateTime& date, int reportNumber, double daysSinceSimulationStart) + : m_date(date), + m_reportNumber(reportNumber), + m_daysSinceSimulationStart(daysSinceSimulationStart) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigEclipseTimeStepInfo::createTimeStepInfos(std::vector dates, + std::vector reportNumbers, + std::vector daysSinceSimulationStarts) +{ + CVF_ASSERT(dates.size() == reportNumbers.size()); + CVF_ASSERT(dates.size() == daysSinceSimulationStarts.size()); + + std::vector timeStepInfos; + + for (size_t i = 0; i < dates.size(); i++) + { + timeStepInfos.push_back(RigEclipseTimeStepInfo(dates[i], reportNumbers[i], daysSinceSimulationStarts[i])); + } + + return timeStepInfos; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigEclipseResultInfo::RigEclipseResultInfo(RiaDefines::ResultCatType resultType, bool needsToBeStored, bool mustBeCalculated, + QString resultName, size_t gridScalarResultIndex) + : m_resultType(resultType), + m_needsToBeStored(needsToBeStored), + m_mustBeCalculated(mustBeCalculated), + m_resultName(resultName), + m_gridScalarResultIndex(gridScalarResultIndex) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigEclipseResultInfo::dates() const +{ + std::vector values; + + for (auto v : m_timeStepInfos) + { + values.push_back(v.m_date); + } + + return values; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigEclipseResultInfo::daysSinceSimulationStarts() const +{ + std::vector values; + + for (auto v : m_timeStepInfos) + { + values.push_back(v.m_daysSinceSimulationStart); + } + + return values; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigEclipseResultInfo::reportNumbers() const +{ + std::vector values; + + for (auto v : m_timeStepInfos) + { + values.push_back(v.m_reportNumber); + } + + return values; +} + diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseResultInfo.h b/ApplicationCode/ReservoirDataModel/RigEclipseResultInfo.h new file mode 100644 index 0000000000..009442e2eb --- /dev/null +++ b/ApplicationCode/ReservoirDataModel/RigEclipseResultInfo.h @@ -0,0 +1,67 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RiaDefines.h" + +#include +#include + +#include + +//================================================================================================== +/// +//================================================================================================== +class RigEclipseTimeStepInfo +{ +public: + RigEclipseTimeStepInfo(const QDateTime& date, int reportNumber, double daysSinceSimulationStart); + + static std::vector createTimeStepInfos(std::vector dates, + std::vector reportNumbers, + std::vector daysSinceSimulationStarts); +public: + QDateTime m_date; + int m_reportNumber; + double m_daysSinceSimulationStart; +}; + + +//================================================================================================== +/// +//================================================================================================== +class RigEclipseResultInfo +{ +public: + RigEclipseResultInfo(RiaDefines::ResultCatType resultType, bool needsToBeStored, bool mustBeCalculated, + QString resultName, size_t gridScalarResultIndex); + + std::vector dates() const; + std::vector daysSinceSimulationStarts() const; + std::vector reportNumbers() const; + +public: + RiaDefines::ResultCatType m_resultType; + bool m_needsToBeStored; + bool m_mustBeCalculated; + QString m_resultName; + size_t m_gridScalarResultIndex; + + std::vector m_timeStepInfos; +}; diff --git a/ApplicationCode/ReservoirDataModel/RigEclipseToStimPlanCellTransmissibilityCalculator.cpp b/ApplicationCode/ReservoirDataModel/RigEclipseToStimPlanCellTransmissibilityCalculator.cpp index f69d25a707..b41fd9abf6 100644 --- a/ApplicationCode/ReservoirDataModel/RigEclipseToStimPlanCellTransmissibilityCalculator.cpp +++ b/ApplicationCode/ReservoirDataModel/RigEclipseToStimPlanCellTransmissibilityCalculator.cpp @@ -84,7 +84,7 @@ void RigEclipseToStimPlanCellTransmissibilityCalculator::calculateStimPlanCellsM const RigEclipseCaseData* eclipseCaseData = m_case->eclipseCaseData(); - RifReaderInterface::PorosityModelResultType porosityModel = RifReaderInterface::MATRIX_RESULTS; + RiaDefines::PorosityModelType porosityModel = RiaDefines::MATRIX_MODEL; RimReservoirCellResultsStorage* gridCellResults = m_case->results(porosityModel); size_t scalarSetIndex; diff --git a/ApplicationCode/ReservoirDataModel/RigFlowDiagInterfaceTools.h b/ApplicationCode/ReservoirDataModel/RigFlowDiagInterfaceTools.h index ce1edb8f84..b8b61a88c1 100644 --- a/ApplicationCode/ReservoirDataModel/RigFlowDiagInterfaceTools.h +++ b/ApplicationCode/ReservoirDataModel/RigFlowDiagInterfaceTools.h @@ -18,6 +18,7 @@ #pragma once +#include "RigFlowDiagResultAddress.h" #include #include @@ -35,15 +36,34 @@ namespace RigFlowDiagInterfaceTools { + std::vector getPhases(RigFlowDiagResultAddress::PhaseSelection phaseSelection) + { + std::vector phases; + + if (phaseSelection & RigFlowDiagResultAddress::PHASE_GAS) + { + phases.push_back(Opm::ECLPhaseIndex::Vapour); + } + if (phaseSelection & RigFlowDiagResultAddress::PHASE_OIL) + { + phases.push_back(Opm::ECLPhaseIndex::Liquid); + } + if (phaseSelection & RigFlowDiagResultAddress::PHASE_WAT) + { + phases.push_back(Opm::ECLPhaseIndex::Aqua); + } + + return phases; + } + template inline Opm::FlowDiagnostics::ConnectionValues extractFluxField(const Opm::ECLGraph& G, - FluxCalc&& getFlux) + FluxCalc&& getFlux, + std::vector actPh) { using ConnVals = Opm::FlowDiagnostics::ConnectionValues; - const auto actPh = G.activePhases(); - auto flux = ConnVals(ConnVals::NumConnections{ G.numConnections() }, ConnVals::NumPhases{ actPh.size() }); @@ -70,7 +90,8 @@ namespace RigFlowDiagInterfaceTools { inline Opm::FlowDiagnostics::ConnectionValues extractFluxFieldFromRestartFile(const Opm::ECLGraph& G, - const Opm::ECLRestartData& rstrt) + const Opm::ECLRestartData& rstrt, + RigFlowDiagResultAddress::PhaseSelection phaseSelection) { auto getFlux = [&G, &rstrt] (const Opm::ECLPhaseIndex p) @@ -78,7 +99,26 @@ namespace RigFlowDiagInterfaceTools { return G.flux(rstrt, p); }; - return extractFluxField(G, getFlux); + return extractFluxField(G, getFlux, getPhases(phaseSelection)); + } + + inline Opm::FlowDiagnostics::ConnectionValues + calculateFluxField(const Opm::ECLGraph& G, + const Opm::ECLInitFileData& init, + const Opm::ECLRestartData& rstrt, + RigFlowDiagResultAddress::PhaseSelection phaseSelection) + { + auto satfunc = Opm::ECLSaturationFunc(G, init); + + Opm::ECLFluxCalc calc(G, std::move(satfunc)); + + auto getFlux = [&calc, &rstrt] + (const Opm::ECLPhaseIndex p) + { + return calc.flux(rstrt, p); + }; + + return extractFluxField(G, getFlux, getPhases(phaseSelection)); } template diff --git a/ApplicationCode/ReservoirDataModel/RigFlowDiagResultAddress.cpp b/ApplicationCode/ReservoirDataModel/RigFlowDiagResultAddress.cpp index e41c37d665..0469dc0ac2 100644 --- a/ApplicationCode/ReservoirDataModel/RigFlowDiagResultAddress.cpp +++ b/ApplicationCode/ReservoirDataModel/RigFlowDiagResultAddress.cpp @@ -18,6 +18,19 @@ #include "RigFlowDiagResultAddress.h" +namespace caf +{ + template<> + void RigFlowDiagResultAddress::PhaseSelectionEnum::setUp() + { + addItem(RigFlowDiagResultAddress::PHASE_ALL, "PHASE_ALL", "All"); + addItem(RigFlowDiagResultAddress::PHASE_OIL, "PHASE_OIL", "Oil"); + addItem(RigFlowDiagResultAddress::PHASE_GAS, "PHASE_GAS", "Gas"); + addItem(RigFlowDiagResultAddress::PHASE_WAT, "PHASE_WAT", "Water"); + + setDefault(RigFlowDiagResultAddress::PHASE_ALL); + } +} //-------------------------------------------------------------------------------------------------- /// @@ -35,6 +48,10 @@ std::string RigFlowDiagResultAddress::uiText() const std::string uiVarname = variableName; std::string uitext = uiVarname; + if (phaseSelection != PHASE_ALL) + { + uitext += " (" + RigFlowDiagResultAddress::PhaseSelectionEnum(phaseSelection).uiText().toStdString() + ")"; + } uitext += " ("; for (const std::string& tracerName : selectedTracerNames) { @@ -49,6 +66,11 @@ std::string RigFlowDiagResultAddress::uiText() const //-------------------------------------------------------------------------------------------------- std::string RigFlowDiagResultAddress::uiShortText() const { - return variableName; + std::string uitext = variableName; + if (phaseSelection != PHASE_ALL) + { + uitext += " (" + RigFlowDiagResultAddress::PhaseSelectionEnum(phaseSelection).uiText().toStdString() + ")"; + } + return uitext; } diff --git a/ApplicationCode/ReservoirDataModel/RigFlowDiagResultAddress.h b/ApplicationCode/ReservoirDataModel/RigFlowDiagResultAddress.h index 7b0844988e..d1a80d738d 100644 --- a/ApplicationCode/ReservoirDataModel/RigFlowDiagResultAddress.h +++ b/ApplicationCode/ReservoirDataModel/RigFlowDiagResultAddress.h @@ -17,6 +17,8 @@ ///////////////////////////////////////////////////////////////////////////////// #pragma once +#include "cafAppEnum.h" + #include #include @@ -37,11 +39,24 @@ class RigFlowDiagResultAddress { public: - RigFlowDiagResultAddress(const std::string& aVariableName, const std::set& someSelectedTracerNames) - : variableName(aVariableName), selectedTracerNames(someSelectedTracerNames) {} + enum PhaseSelection + { + PHASE_ALL = 0b111, + PHASE_OIL = 0b001, + PHASE_GAS = 0b010, + PHASE_WAT = 0b100, + }; - RigFlowDiagResultAddress(const std::string& aVariableName, const std::string& tracerName) - : variableName(aVariableName) + typedef caf::AppEnum PhaseSelectionEnum; + + RigFlowDiagResultAddress(const std::string& aVariableName, PhaseSelection phaseSelection, const std::set& someSelectedTracerNames) + : variableName(aVariableName), + phaseSelection(phaseSelection), + selectedTracerNames(someSelectedTracerNames) {} + + RigFlowDiagResultAddress(const std::string& aVariableName, PhaseSelection phaseSelection, const std::string& tracerName) + : variableName(aVariableName), + phaseSelection(phaseSelection) { selectedTracerNames.insert(tracerName); } @@ -53,6 +68,7 @@ public: std::string variableName; std::set selectedTracerNames; + PhaseSelection phaseSelection; bool operator< (const RigFlowDiagResultAddress& other) const { @@ -60,6 +76,10 @@ public: { return selectedTracerNames < other.selectedTracerNames; } + if (phaseSelection != other.phaseSelection) + { + return phaseSelection < other.phaseSelection; + } return variableName < other.variableName; } diff --git a/ApplicationCode/ReservoirDataModel/RigFlowDiagResults.cpp b/ApplicationCode/ReservoirDataModel/RigFlowDiagResults.cpp index 1261d74b61..c212dd2ee1 100644 --- a/ApplicationCode/ReservoirDataModel/RigFlowDiagResults.cpp +++ b/ApplicationCode/ReservoirDataModel/RigFlowDiagResults.cpp @@ -39,9 +39,8 @@ RigFlowDiagResults::RigFlowDiagResults(RimFlowDiagSolution* flowSolution, size_t { m_timeStepCount = timeStepCount; - m_hasAtemptedNativeResults.resize(timeStepCount, false); + m_hasAtemptedNativeResults.resize(timeStepCount); m_injProdPairFluxCommunicationTimesteps.resize(timeStepCount); - m_flowCharResultFrames.resize(timeStepCount); } //-------------------------------------------------------------------------------------------------- @@ -71,7 +70,7 @@ const RigActiveCellInfo * RigFlowDiagResults::activeCellInfo(const RigFlowDiagRe RimEclipseResultCase* eclCase; m_flowDiagSolution->firstAncestorOrThisOfType(eclCase); - return eclCase->eclipseCaseData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS); // Todo: base on resVarAddr member + return eclCase->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL); // Todo: base on resVarAddr member } //-------------------------------------------------------------------------------------------------- @@ -92,7 +91,7 @@ const std::vector* RigFlowDiagResults::findOrCalculateResult(const RigFl if (!solverInterface()) return nullptr; - calculateNativeResultsIfNotPreviouslyAttempted(frameIndex); + calculateNativeResultsIfNotPreviouslyAttempted(frameIndex, resVarAddr.phaseSelection); return findScalarResultFrame(resVarAddr, frameIndex); } @@ -100,12 +99,14 @@ const std::vector* RigFlowDiagResults::findOrCalculateResult(const RigFl //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigFlowDiagResults::calculateNativeResultsIfNotPreviouslyAttempted(size_t frameIndex) +void RigFlowDiagResults::calculateNativeResultsIfNotPreviouslyAttempted(size_t frameIndex, RigFlowDiagResultAddress::PhaseSelection phaseSelection) { - if ( !m_hasAtemptedNativeResults[frameIndex] ) + auto it = m_hasAtemptedNativeResults[frameIndex].find(phaseSelection); + if ( it == m_hasAtemptedNativeResults[frameIndex].end() || !it->second ) { RigFlowDiagTimeStepResult nativeTimestepResults = solverInterface()->calculate(frameIndex, + phaseSelection, m_flowDiagSolution->allInjectorTracerActiveCellIndices(frameIndex), m_flowDiagSolution->allProducerTracerActiveCellIndices(frameIndex)); @@ -119,15 +120,9 @@ void RigFlowDiagResults::calculateNativeResultsIfNotPreviouslyAttempted(size_t f nativeResFrames->frameData(frameIndex).swap(resIt.second); } - m_injProdPairFluxCommunicationTimesteps[frameIndex].swap(nativeTimestepResults.injProdWellPairFluxes()); + m_injProdPairFluxCommunicationTimesteps[frameIndex][phaseSelection].swap(nativeTimestepResults.injProdWellPairFluxes()); - m_flowCharResultFrames[frameIndex].m_lorenzCoefficient = nativeTimestepResults.lorenzCoefficient(); - m_flowCharResultFrames[frameIndex].m_flowCapStorageCapCurve.first.swap(nativeTimestepResults.flowCapStorageCapCurve().first); - m_flowCharResultFrames[frameIndex].m_flowCapStorageCapCurve.second.swap(nativeTimestepResults.flowCapStorageCapCurve().second); - m_flowCharResultFrames[frameIndex].m_sweepEfficiencyCurve.first.swap(nativeTimestepResults.sweepEfficiencyCurve().first); - m_flowCharResultFrames[frameIndex].m_sweepEfficiencyCurve.second.swap(nativeTimestepResults.sweepEfficiencyCurve().second); - - m_hasAtemptedNativeResults[frameIndex] = true; + m_hasAtemptedNativeResults[frameIndex][phaseSelection] = true; } } @@ -428,7 +423,7 @@ std::vector* > RigFlowDiagResults::findResultsForSelec if (tracerType != RimFlowDiagSolution::CLOSED && ( tracerType == wantedTracerType || wantedTracerType == RimFlowDiagSolution::UNDEFINED) ) { - selectedTracersResults.push_back(findOrCalculateResult(RigFlowDiagResultAddress(nativeResultName, tracerName), frameIndex)); + selectedTracersResults.push_back(findOrCalculateResult(RigFlowDiagResultAddress(nativeResultName, resVarAddr.phaseSelection, tracerName), frameIndex)); } } @@ -455,7 +450,7 @@ RigFlowDiagResults::findNamedResultsForSelectedTracers(const RigFlowDiagResultAd if (tracerType != RimFlowDiagSolution::CLOSED && ( tracerType == wantedTracerType || wantedTracerType == RimFlowDiagSolution::UNDEFINED) ) { - selectedTracersResults.push_back(std::make_pair(tracerName, findOrCalculateResult(RigFlowDiagResultAddress(nativeResultName, tracerName), frameIndex))); + selectedTracersResults.push_back(std::make_pair(tracerName, findOrCalculateResult(RigFlowDiagResultAddress(nativeResultName, resVarAddr.phaseSelection, tracerName), frameIndex))); } } @@ -632,10 +627,10 @@ std::pair RigFlowDiagResults::injectorProducerPairFluxes(const s const std::string& prodTracerName, int frameIndex) { - calculateNativeResultsIfNotPreviouslyAttempted(frameIndex); + calculateNativeResultsIfNotPreviouslyAttempted(frameIndex, RigFlowDiagResultAddress::PHASE_ALL); - auto commPair = m_injProdPairFluxCommunicationTimesteps[frameIndex].find(std::make_pair(injTracername, prodTracerName)); - if (commPair != m_injProdPairFluxCommunicationTimesteps[frameIndex].end()) + auto commPair = m_injProdPairFluxCommunicationTimesteps[frameIndex][RigFlowDiagResultAddress::PHASE_ALL].find(std::make_pair(injTracername, prodTracerName)); + if (commPair != m_injProdPairFluxCommunicationTimesteps[frameIndex][RigFlowDiagResultAddress::PHASE_ALL].end()) { return commPair->second; } @@ -650,10 +645,10 @@ std::pair RigFlowDiagResults::injectorProducerPairFluxes(const s //-------------------------------------------------------------------------------------------------- double RigFlowDiagResults::maxAbsPairFlux(int frameIndex) { - calculateNativeResultsIfNotPreviouslyAttempted(frameIndex); + calculateNativeResultsIfNotPreviouslyAttempted(frameIndex, RigFlowDiagResultAddress::PHASE_ALL); double maxFlux = 0.0; - for (const auto& commPair : m_injProdPairFluxCommunicationTimesteps[frameIndex]) + for (const auto& commPair : m_injProdPairFluxCommunicationTimesteps[frameIndex][RigFlowDiagResultAddress::PHASE_ALL]) { if (fabs(commPair.second.first) > maxFlux ) maxFlux = fabs(commPair.second.first); if (fabs(commPair.second.second) > maxFlux ) maxFlux = fabs(commPair.second.second); @@ -665,12 +660,16 @@ double RigFlowDiagResults::maxAbsPairFlux(int frameIndex) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RigFlowDiagResults::calculatedTimeSteps() +std::vector RigFlowDiagResults::calculatedTimeSteps(RigFlowDiagResultAddress::PhaseSelection phaseSelection) { std::vector timestepIndices; for (size_t tsIdx = 0; tsIdx < m_timeStepCount; ++tsIdx) { - if (m_hasAtemptedNativeResults[tsIdx]) timestepIndices.push_back(static_cast(tsIdx)); + auto it = m_hasAtemptedNativeResults[tsIdx].find(phaseSelection); + if (it != m_hasAtemptedNativeResults[tsIdx].end() && it->second) + { + timestepIndices.push_back(static_cast(tsIdx)); + } } return timestepIndices; @@ -679,8 +678,31 @@ std::vector RigFlowDiagResults::calculatedTimeSteps() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RigFlowDiagResults::FlowCharacteristicsResultFrame::FlowCharacteristicsResultFrame() - : m_lorenzCoefficient(HUGE_VAL) +RigFlowDiagSolverInterface::FlowCharacteristicsResultFrame RigFlowDiagResults::flowCharacteristicsResults(int frameIndex, double max_pv_fraction) { + std::vector tracerNames = m_flowDiagSolution->tracerNames(); + + std::set injectorNames; + std::set producerNames; + for (const QString& tracerName : tracerNames) + { + RimFlowDiagSolution::TracerStatusType status = m_flowDiagSolution->tracerStatusInTimeStep(tracerName, frameIndex); + if (status == RimFlowDiagSolution::INJECTOR) + { + injectorNames.insert(tracerName.toStdString()); + } + else if (status == RimFlowDiagSolution::PRODUCER) + { + producerNames.insert(tracerName.toStdString()); + } + } + + RigFlowDiagResultAddress injectorAddress(RIG_FLD_TOF_RESNAME, RigFlowDiagResultAddress::PHASE_ALL, injectorNames); + RigFlowDiagResultAddress producerAddress(RIG_FLD_TOF_RESNAME, RigFlowDiagResultAddress::PHASE_ALL, producerNames); + + const std::vector* injectorResults = resultValues(injectorAddress, frameIndex); + const std::vector* producerResults = resultValues(producerAddress, frameIndex); + + return solverInterface()->calculateFlowCharacteristics(injectorResults, producerResults, max_pv_fraction); } diff --git a/ApplicationCode/ReservoirDataModel/RigFlowDiagResults.h b/ApplicationCode/ReservoirDataModel/RigFlowDiagResults.h index fa230eb809..2935e451fc 100644 --- a/ApplicationCode/ReservoirDataModel/RigFlowDiagResults.h +++ b/ApplicationCode/ReservoirDataModel/RigFlowDiagResults.h @@ -19,6 +19,8 @@ #include "RigFlowDiagResultAddress.h" +#include "RigFlowDiagSolverInterface.h" + #include "RimFlowDiagSolution.h" #include "cafPdmPointer.h" @@ -32,7 +34,6 @@ class RigFlowDiagResultFrames; class RigStatisticsDataCache; -class RigFlowDiagSolverInterface; class RigActiveCellInfo; class RigFlowDiagResults: public cvf::Object @@ -63,24 +64,14 @@ public: std::pair injectorProducerPairFluxes(const std::string& injTracername, const std::string& prodTracerName, int frameIndex); double maxAbsPairFlux(int frameIndex); - std::vector calculatedTimeSteps(); + std::vector calculatedTimeSteps(RigFlowDiagResultAddress::PhaseSelection phaseSelection); - struct FlowCharacteristicsResultFrame - { - FlowCharacteristicsResultFrame(); - using Curve = std::pair< std::vector, std::vector >; - - Curve m_flowCapStorageCapCurve; - Curve m_sweepEfficiencyCurve; - double m_lorenzCoefficient; - }; - - const FlowCharacteristicsResultFrame& flowCharacteristicsResults(int frameIndex) { return m_flowCharResultFrames[frameIndex];} + RigFlowDiagSolverInterface::FlowCharacteristicsResultFrame flowCharacteristicsResults(int frameIndex, double max_pv_fraction); private: const std::vector* findOrCalculateResult (const RigFlowDiagResultAddress& resVarAddr, size_t frameIndex); - void calculateNativeResultsIfNotPreviouslyAttempted(size_t frameIndex); + void calculateNativeResultsIfNotPreviouslyAttempted(size_t frameIndex, RigFlowDiagResultAddress::PhaseSelection phaseSelection); std::vector* calculateDerivedResult(const RigFlowDiagResultAddress& resVarAddr, size_t frameIndex); @@ -126,18 +117,13 @@ private: size_t m_timeStepCount; caf::PdmPointer m_flowDiagSolution; - std::vector m_hasAtemptedNativeResults; + std::vector< std::map > m_hasAtemptedNativeResults; std::map< RigFlowDiagResultAddress, cvf::ref > m_resultSets; std::map< RigFlowDiagResultAddress, cvf::ref > m_resultStatistics; using InjectorProducerCommunicationMap = std::map< std::pair, std::pair >; - std::vector m_injProdPairFluxCommunicationTimesteps; - - - - std::vector m_flowCharResultFrames; - + std::vector< std::map > m_injProdPairFluxCommunicationTimesteps; }; diff --git a/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp b/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp index a69cdf5192..edff3fc51c 100644 --- a/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp +++ b/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp @@ -39,7 +39,7 @@ /// //-------------------------------------------------------------------------------------------------- RigFlowDiagTimeStepResult::RigFlowDiagTimeStepResult(size_t activeCellCount) - : m_activeCellCount(activeCellCount), m_lorenzCoefficient(HUGE_VAL) + : m_activeCellCount(activeCellCount) { } @@ -49,12 +49,14 @@ RigFlowDiagTimeStepResult::RigFlowDiagTimeStepResult(size_t activeCellCount) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigFlowDiagTimeStepResult::setTracerTOF(const std::string& tracerName, const std::map& cellValues) +void RigFlowDiagTimeStepResult::setTracerTOF(const std::string& tracerName, + RigFlowDiagResultAddress::PhaseSelection phaseSelection, + const std::map& cellValues) { std::set tracers; tracers.insert(tracerName); - RigFlowDiagResultAddress resAddr(RIG_FLD_TOF_RESNAME, tracers); + RigFlowDiagResultAddress resAddr(RIG_FLD_TOF_RESNAME, phaseSelection, tracers); this->addResult(resAddr, cellValues); @@ -68,12 +70,14 @@ void RigFlowDiagTimeStepResult::setTracerTOF(const std::string& tracerName, cons //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigFlowDiagTimeStepResult::setTracerFraction(const std::string& tracerName, const std::map& cellValues) +void RigFlowDiagTimeStepResult::setTracerFraction(const std::string& tracerName, + RigFlowDiagResultAddress::PhaseSelection phaseSelection, + const std::map& cellValues) { std::set tracers; tracers.insert(tracerName); - this->addResult(RigFlowDiagResultAddress(RIG_FLD_CELL_FRACTION_RESNAME, tracers), cellValues); + this->addResult(RigFlowDiagResultAddress(RIG_FLD_CELL_FRACTION_RESNAME, phaseSelection, tracers), cellValues); } //-------------------------------------------------------------------------------------------------- @@ -148,12 +152,13 @@ RigFlowDiagSolverInterface::~RigFlowDiagSolverInterface() /// //-------------------------------------------------------------------------------------------------- RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepIndex, + RigFlowDiagResultAddress::PhaseSelection phaseSelection, std::map > injectorTracers, std::map > producerTracers) { using namespace Opm::FlowDiagnostics; - RigFlowDiagTimeStepResult result(m_eclipseCase->eclipseCaseData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->reservoirActiveCellCount()); + RigFlowDiagTimeStepResult result(m_eclipseCase->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL)->reservoirActiveCellCount()); caf::ProgressInfo progressInfo(8, "Calculating Flow Diagnostics"); @@ -164,14 +169,11 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI // Get set of files QString gridFileName = m_eclipseCase->gridFileName(); - QStringList m_filesWithSameBaseName; + std::string initFileName = getInitFileName(); - if ( !RifEclipseOutputFileTools::findSiblingFilesWithSameBaseName(gridFileName, &m_filesWithSameBaseName) ) return result; + if (initFileName.empty()) return result; - QString initFileName = RifEclipseOutputFileTools::firstFileNameOfType(m_filesWithSameBaseName, ECL_INIT_FILE); - - m_opmFlowDiagStaticData = new RigOpmFlowDiagStaticData(gridFileName.toStdString(), - initFileName.toStdString()); + m_opmFlowDiagStaticData = new RigOpmFlowDiagStaticData(gridFileName.toStdString(), initFileName); progressInfo.incrementProgress(); progressInfo.setProgressDescription("Calculating Connectivities"); @@ -189,6 +191,9 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI m_opmFlowDiagStaticData->m_fldToolbox->assignPoreVolume( m_opmFlowDiagStaticData->m_poreVolume); // Look for unified restart file + QStringList m_filesWithSameBaseName; + + if ( !RifEclipseOutputFileTools::findSiblingFilesWithSameBaseName(gridFileName, &m_filesWithSameBaseName) ) return result; QString restartFileName = RifEclipseOutputFileTools::firstFileNameOfType(m_filesWithSameBaseName, ECL_UNIFIED_RESTART_FILE); if ( !restartFileName.isEmpty() ) @@ -201,7 +206,7 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI QStringList restartFileNames = RifEclipseOutputFileTools::filterFileNamesOfType(m_filesWithSameBaseName, ECL_RESTART_FILE); size_t restartFileCount = static_cast(restartFileNames.size()); - size_t maxTimeStepCount = m_eclipseCase->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->maxTimeStepCount(); + size_t maxTimeStepCount = m_eclipseCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->maxTimeStepCount(); if (restartFileCount <= timeStepIndex && restartFileCount != maxTimeStepCount ) { @@ -236,9 +241,9 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI CVF_ASSERT(currentRestartData); size_t resultIndexWithMaxTimeSteps = cvf::UNDEFINED_SIZE_T; - m_eclipseCase->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->maxTimeStepCount(&resultIndexWithMaxTimeSteps); + m_eclipseCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->maxTimeStepCount(&resultIndexWithMaxTimeSteps); - int reportStepNumber = m_eclipseCase->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->reportStepNumber(resultIndexWithMaxTimeSteps, timeStepIndex); + int reportStepNumber = m_eclipseCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->reportStepNumber(resultIndexWithMaxTimeSteps, timeStepIndex); if ( !currentRestartData->selectReportStep(reportStepNumber) ) { @@ -251,10 +256,20 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI Opm::FlowDiagnostics::CellSetValues sumWellFluxPrCell; { - Opm::FlowDiagnostics::ConnectionValues connectionsVals = RigFlowDiagInterfaceTools::extractFluxFieldFromRestartFile(*(m_opmFlowDiagStaticData->m_eclGraph), - *currentRestartData); + if (m_eclipseCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->hasFlowDiagUsableFluxes()) + { + Opm::FlowDiagnostics::ConnectionValues connectionsVals = RigFlowDiagInterfaceTools::extractFluxFieldFromRestartFile(*(m_opmFlowDiagStaticData->m_eclGraph), + *currentRestartData, + phaseSelection); + m_opmFlowDiagStaticData->m_fldToolbox->assignConnectionFlux(connectionsVals); + } + else + { + Opm::ECLInitFileData init(getInitFileName()); + Opm::FlowDiagnostics::ConnectionValues connectionVals = RigFlowDiagInterfaceTools::calculateFluxField((*m_opmFlowDiagStaticData->m_eclGraph), init, *currentRestartData, phaseSelection); + m_opmFlowDiagStaticData->m_fldToolbox->assignConnectionFlux(connectionVals); + } - m_opmFlowDiagStaticData->m_fldToolbox->assignConnectionFlux(connectionsVals); progressInfo.incrementProgress(); @@ -334,9 +349,9 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI for ( const CellSetID& tracerId: injectorSolution->fd.startPoints() ) { CellSetValues tofVals = injectorSolution->fd.timeOfFlight(tracerId); - result.setTracerTOF(tracerId.to_string(), tofVals); + result.setTracerTOF(tracerId.to_string(), phaseSelection, tofVals); CellSetValues fracVals = injectorSolution->fd.concentration(tracerId); - result.setTracerFraction(tracerId.to_string(), fracVals); + result.setTracerFraction(tracerId.to_string(), phaseSelection, fracVals); } progressInfo.incrementProgress(); @@ -364,9 +379,9 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI for ( const CellSetID& tracerId: producerSolution->fd.startPoints() ) { CellSetValues tofVals = producerSolution->fd.timeOfFlight(tracerId); - result.setTracerTOF(tracerId.to_string(), tofVals); + result.setTracerTOF(tracerId.to_string(), phaseSelection, tofVals); CellSetValues fracVals = producerSolution->fd.concentration(tracerId); - result.setTracerFraction(tracerId.to_string(), fracVals); + result.setTracerFraction(tracerId.to_string(), phaseSelection, fracVals); } progressInfo.incrementProgress(); @@ -394,24 +409,67 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI } } } - - try - { - Graph flowCapStorCapCurve = flowCapacityStorageCapacityCurve(*(injectorSolution.get()), - *(producerSolution.get()), - m_opmFlowDiagStaticData->m_poreVolume, - 0.1); - - result.setFlowCapStorageCapCurve(flowCapStorCapCurve); - result.setSweepEfficiencyCurve(sweepEfficiency(flowCapStorCapCurve)); - result.setLorenzCoefficient(lorenzCoefficient(flowCapStorCapCurve)); - } - catch ( const std::exception& e ) - { - QMessageBox::critical(nullptr, "ResInsight", "Flow Diagnostics: " + QString(e.what())); - } } return result; // Relying on implicit move constructor } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigFlowDiagSolverInterface::FlowCharacteristicsResultFrame RigFlowDiagSolverInterface::calculateFlowCharacteristics(const std::vector* injector_tof, + const std::vector* producer_tof, + double max_pv_fraction) +{ + using namespace Opm::FlowDiagnostics; + RigFlowDiagSolverInterface::FlowCharacteristicsResultFrame result; + + if (injector_tof == nullptr || producer_tof == nullptr) + { + return result; + } + + try + { + Graph flowCapStorCapCurve = flowCapacityStorageCapacityCurve(*injector_tof, + *producer_tof, + m_opmFlowDiagStaticData->m_poreVolume, + max_pv_fraction); + + result.m_flowCapStorageCapCurve = flowCapStorCapCurve; + result.m_lorenzCoefficient = lorenzCoefficient(flowCapStorCapCurve); + result.m_sweepEfficiencyCurve = sweepEfficiency(flowCapStorCapCurve); + } + catch (const std::exception& e) + { + QMessageBox::critical(nullptr, "ResInsight", "Flow Diagnostics: " + QString(e.what())); + } + + return result; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::string RigFlowDiagSolverInterface::getInitFileName() const +{ + QString gridFileName = m_eclipseCase->gridFileName(); + + QStringList m_filesWithSameBaseName; + + if (!RifEclipseOutputFileTools::findSiblingFilesWithSameBaseName(gridFileName, &m_filesWithSameBaseName)) return std::string(); + + QString initFileName = RifEclipseOutputFileTools::firstFileNameOfType(m_filesWithSameBaseName, ECL_INIT_FILE); + + return initFileName.toStdString(); +} + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigFlowDiagSolverInterface::FlowCharacteristicsResultFrame::FlowCharacteristicsResultFrame() + : m_lorenzCoefficient(HUGE_VAL) +{ + +} diff --git a/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.h b/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.h index 81a154b715..eee1f75860 100644 --- a/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.h +++ b/ApplicationCode/ReservoirDataModel/RigFlowDiagSolverInterface.h @@ -35,25 +35,18 @@ class RigFlowDiagTimeStepResult public: explicit RigFlowDiagTimeStepResult(size_t activeCellCount); - void setTracerTOF (const std::string& tracerName, const std::map& cellValues); - void setTracerFraction(const std::string& tracerName, const std::map& cellValues); + void setTracerTOF (const std::string& tracerName, RigFlowDiagResultAddress::PhaseSelection phaseSelection, const std::map& cellValues); + void setTracerFraction(const std::string& tracerName, RigFlowDiagResultAddress::PhaseSelection phaseSelection, const std::map& cellValues); void setInjProdWellPairFlux(const std::string& injectorTracerName, const std::string& producerTracerName, const std::pair& injProdFluxes) ; using Curve = std::pair< std::vector, std::vector >; - void setFlowCapStorageCapCurve(const Curve& flCapStCapCurve) { m_flowCapStorageCapCurve = flCapStCapCurve;} - void setSweepEfficiencyCurve(const Curve& sweepEffCurve) { m_sweepEfficiencyCurve = sweepEffCurve; } - void setLorenzCoefficient(double coeff) { m_lorenzCoefficient = coeff;} // Used to "steal" the data from this one using swap std::map >& nativeResults() { return m_nativeResults; } std::map, std::pair > & injProdWellPairFluxes() { return m_injProdWellPairFluxes; } - Curve& flowCapStorageCapCurve() { return m_flowCapStorageCapCurve; } - Curve& sweepEfficiencyCurve() { return m_sweepEfficiencyCurve; } - double lorenzCoefficient() { return m_lorenzCoefficient;} - private: void addResult(const RigFlowDiagResultAddress& resAddr, const std::map& cellValues); @@ -61,10 +54,6 @@ private: std::map > m_nativeResults; std::map, std::pair > m_injProdWellPairFluxes; - Curve m_flowCapStorageCapCurve; - Curve m_sweepEfficiencyCurve; - double m_lorenzCoefficient; - size_t m_activeCellCount; }; @@ -74,15 +63,34 @@ class RigOpmFlowDiagStaticData; class RigFlowDiagSolverInterface : public cvf::Object { +public: + struct FlowCharacteristicsResultFrame + { + FlowCharacteristicsResultFrame(); + + using Curve = std::pair< std::vector, std::vector >; + + Curve m_flowCapStorageCapCurve; + Curve m_sweepEfficiencyCurve; + double m_lorenzCoefficient; + }; + public: explicit RigFlowDiagSolverInterface(RimEclipseResultCase * eclipseCase); virtual ~RigFlowDiagSolverInterface(); RigFlowDiagTimeStepResult calculate(size_t timestep, + RigFlowDiagResultAddress::PhaseSelection phaseSelection, std::map > injectorTracers, std::map > producerTracers); + FlowCharacteristicsResultFrame calculateFlowCharacteristics(const std::vector* injector_tof, + const std::vector* producer_tof, + double max_pv_fraction); + private: + std::string getInitFileName() const; + RimEclipseResultCase * m_eclipseCase; cvf::ref m_opmFlowDiagStaticData; diff --git a/ApplicationCode/ReservoirDataModel/RigReservoirBuilderMock.cpp b/ApplicationCode/ReservoirDataModel/RigReservoirBuilderMock.cpp index e928da4c44..1b5808ac81 100644 --- a/ApplicationCode/ReservoirDataModel/RigReservoirBuilderMock.cpp +++ b/ApplicationCode/ReservoirDataModel/RigReservoirBuilderMock.cpp @@ -250,7 +250,7 @@ void RigReservoirBuilderMock::populateReservoir(RigEclipseCaseData* eclipseCase) addFaults(eclipseCase); // Set all cells active - RigActiveCellInfo* activeCellInfo = eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS); + RigActiveCellInfo* activeCellInfo = eclipseCase->activeCellInfo(RiaDefines::MATRIX_MODEL); activeCellInfo->setReservoirCellCount(eclipseCase->mainGrid()->globalCellArray().size()); for (size_t i = 0; i < eclipseCase->mainGrid()->globalCellArray().size(); i++) { diff --git a/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.cpp b/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.cpp index 9315459e4b..6e619e82f3 100644 --- a/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.cpp +++ b/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.cpp @@ -41,7 +41,7 @@ //-------------------------------------------------------------------------------------------------- cvf::ref RigResultAccessorFactory::createFromUiResultName(const RigEclipseCaseData* eclipseCase, size_t gridIndex, - RifReaderInterface::PorosityModelResultType porosityModel, + RiaDefines::PorosityModelType porosityModel, size_t timeStepIndex, const QString& uiResultName) { @@ -134,7 +134,7 @@ cvf::ref RigResultAccessorFactory::createFromUiResultName(con //-------------------------------------------------------------------------------------------------- cvf::ref RigResultAccessorFactory::createFromNameAndType(const RigEclipseCaseData* eclipseCase, size_t gridIndex, - RifReaderInterface::PorosityModelResultType porosityModel, + RiaDefines::PorosityModelType porosityModel, size_t timeStepIndex, const QString& uiResultName, RiaDefines::ResultCatType resultType) @@ -172,8 +172,6 @@ cvf::ref RigResultAccessorFactory::createFromResultDefinition size_t timeStepIndex, RimEclipseResultDefinition* resultDefinition) { - RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(resultDefinition->porosityModel()); - if (resultDefinition->resultType() != RiaDefines::FLOW_DIAGNOSTICS) { @@ -185,7 +183,7 @@ cvf::ref RigResultAccessorFactory::createFromResultDefinition return RigResultAccessorFactory::createFromUiResultName(eclipseCase, gridIndex, - porosityModel, + resultDefinition->porosityModel(), adjustedTimeStepIndex, resultDefinition->resultVariable()); } @@ -200,7 +198,7 @@ cvf::ref RigResultAccessorFactory::createFromResultDefinition const RigGridBase* grid = eclipseCase->grid(gridIndex); if ( !grid ) return new RigHugeValResultAccessor; - cvf::ref object = new RigActiveCellsResultAccessor(grid, resultValues, eclipseCase->activeCellInfo(porosityModel)); + cvf::ref object = new RigActiveCellsResultAccessor(grid, resultValues, eclipseCase->activeCellInfo(resultDefinition->porosityModel())); return object; } @@ -211,7 +209,7 @@ cvf::ref RigResultAccessorFactory::createFromResultDefinition //-------------------------------------------------------------------------------------------------- cvf::ref RigResultAccessorFactory::createNativeFromUiResultName(const RigEclipseCaseData* eclipseCase, size_t gridIndex, - RifReaderInterface::PorosityModelResultType porosityModel, + RiaDefines::PorosityModelType porosityModel, size_t timeStepIndex, const QString& uiResultName) { @@ -239,7 +237,7 @@ cvf::ref RigResultAccessorFactory::createNativeFromUiResultNa //-------------------------------------------------------------------------------------------------- cvf::ref RigResultAccessorFactory::createFromResultIdx(const RigEclipseCaseData* eclipseCase, size_t gridIndex, - RifReaderInterface::PorosityModelResultType porosityModel, + RiaDefines::PorosityModelType porosityModel, size_t timeStepIndex, size_t resultIndex) { diff --git a/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.h b/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.h index 05deb8470a..375f85dadb 100644 --- a/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.h +++ b/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.h @@ -41,14 +41,14 @@ public: static cvf::ref createFromUiResultName(const RigEclipseCaseData* eclipseCase, size_t gridIndex, - RifReaderInterface::PorosityModelResultType porosityModel, + RiaDefines::PorosityModelType porosityModel, size_t timeStepIndex, const QString& uiResultName); static cvf::ref createFromNameAndType(const RigEclipseCaseData* eclipseCase, size_t gridIndex, - RifReaderInterface::PorosityModelResultType porosityModel, + RiaDefines::PorosityModelType porosityModel, size_t timeStepIndex, const QString& uiResultName, RiaDefines::ResultCatType resultType); @@ -56,7 +56,7 @@ public: static cvf::ref createFromResultIdx(const RigEclipseCaseData* eclipseCase, size_t gridIndex, - RifReaderInterface::PorosityModelResultType porosityModel, + RiaDefines::PorosityModelType porosityModel, size_t timeStepIndex, size_t resultIndex); @@ -64,7 +64,7 @@ private: static cvf::ref createNativeFromUiResultName(const RigEclipseCaseData* eclipseCase, size_t gridIndex, - RifReaderInterface::PorosityModelResultType porosityModel, + RiaDefines::PorosityModelType porosityModel, size_t timeStepIndex, const QString& resultName); diff --git a/ApplicationCode/ReservoirDataModel/RigResultModifierFactory.cpp b/ApplicationCode/ReservoirDataModel/RigResultModifierFactory.cpp index 0515009f7f..ba772a5837 100644 --- a/ApplicationCode/ReservoirDataModel/RigResultModifierFactory.cpp +++ b/ApplicationCode/ReservoirDataModel/RigResultModifierFactory.cpp @@ -31,7 +31,7 @@ //-------------------------------------------------------------------------------------------------- cvf::ref RigResultModifierFactory::createResultModifier(RigEclipseCaseData* eclipseCase, size_t gridIndex, - RifReaderInterface::PorosityModelResultType porosityModel, + RiaDefines::PorosityModelType porosityModel, size_t timeStepIndex, QString& uiResultName) { @@ -53,7 +53,7 @@ cvf::ref RigResultModifierFactory::createResultModifier(RigEc //-------------------------------------------------------------------------------------------------- cvf::ref RigResultModifierFactory::createResultModifier(RigEclipseCaseData* eclipseCase, size_t gridIndex, - RifReaderInterface::PorosityModelResultType porosityModel, + RiaDefines::PorosityModelType porosityModel, size_t timeStepIndex, size_t scalarResultIndex) { if ( !eclipseCase ) return NULL; diff --git a/ApplicationCode/ReservoirDataModel/RigResultModifierFactory.h b/ApplicationCode/ReservoirDataModel/RigResultModifierFactory.h index 61b36d3425..9de9a938c1 100644 --- a/ApplicationCode/ReservoirDataModel/RigResultModifierFactory.h +++ b/ApplicationCode/ReservoirDataModel/RigResultModifierFactory.h @@ -30,14 +30,14 @@ public: static cvf::ref createResultModifier(RigEclipseCaseData* eclipseCase, size_t gridIndex, - RifReaderInterface::PorosityModelResultType porosityModel, + RiaDefines::PorosityModelType porosityModel, size_t timeStepIndex, QString& uiResultName); static cvf::ref createResultModifier(RigEclipseCaseData* eclipseCase, size_t gridIndex, - RifReaderInterface::PorosityModelResultType porosityModel, + RiaDefines::PorosityModelType porosityModel, size_t timeStepIndex, size_t scalarResultIndex); }; diff --git a/ApplicationCode/ReservoirDataModel/RigSingleWellResultsData.cpp b/ApplicationCode/ReservoirDataModel/RigSingleWellResultsData.cpp index 3cb3831d9a..116a9d1e3e 100644 --- a/ApplicationCode/ReservoirDataModel/RigSingleWellResultsData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigSingleWellResultsData.cpp @@ -37,12 +37,12 @@ const RigWellResultFrame& RigSingleWellResultsData::wellResultFrame(size_t resul //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigSingleWellResultsData::computeMappingFromResultTimeIndicesToWellTimeIndices(const std::vector& resultTimes) +void RigSingleWellResultsData::computeMappingFromResultTimeIndicesToWellTimeIndices(const std::vector& simulationTimeSteps) { m_resultTimeStepIndexToWellTimeStepIndex.clear(); if (m_wellCellsTimeSteps.size() == 0) return; - m_resultTimeStepIndexToWellTimeStepIndex.resize(resultTimes.size(), cvf::UNDEFINED_SIZE_T); + m_resultTimeStepIndexToWellTimeStepIndex.resize(simulationTimeSteps.size(), cvf::UNDEFINED_SIZE_T); if (false) { @@ -54,29 +54,23 @@ void RigSingleWellResultsData::computeMappingFromResultTimeIndicesToWellTimeIndi } qDebug() << "Result TimeStamps"; - for (size_t i = 0; i < resultTimes.size(); i++) + for (size_t i = 0; i < simulationTimeSteps.size(); i++) { - qDebug() << resultTimes[i].toString(); + qDebug() << simulationTimeSteps[i].toString(); } - } - int resultIdx = 0; - size_t wellIdx = 0; - size_t activeWellIdx = cvf::UNDEFINED_SIZE_T; - - while (wellIdx <= m_wellCellsTimeSteps.size() && resultIdx < static_cast(resultTimes.size())) + for (size_t resultTimeStepIndex = 0; resultTimeStepIndex< simulationTimeSteps.size(); resultTimeStepIndex++) { - if (wellIdx < m_wellCellsTimeSteps.size() && m_wellCellsTimeSteps[wellIdx].m_timestamp <= resultTimes[resultIdx]) + size_t wellTimeStepIndex = 0; + + while (wellTimeStepIndex < m_wellCellsTimeSteps.size() && + m_wellCellsTimeSteps[wellTimeStepIndex].m_timestamp < simulationTimeSteps[resultTimeStepIndex]) { - activeWellIdx = wellIdx; - wellIdx++; + wellTimeStepIndex++; } - CVF_ASSERT(resultIdx < static_cast(m_resultTimeStepIndexToWellTimeStepIndex.size())); - m_resultTimeStepIndexToWellTimeStepIndex[resultIdx] = activeWellIdx; - - resultIdx++; + m_resultTimeStepIndexToWellTimeStepIndex[resultTimeStepIndex] = wellTimeStepIndex; } } diff --git a/ApplicationCode/ReservoirDataModel/RigSingleWellResultsData.h b/ApplicationCode/ReservoirDataModel/RigSingleWellResultsData.h index 75c253e886..98017a3dea 100644 --- a/ApplicationCode/ReservoirDataModel/RigSingleWellResultsData.h +++ b/ApplicationCode/ReservoirDataModel/RigSingleWellResultsData.h @@ -21,12 +21,12 @@ #include "cvfBase.h" #include "cvfObject.h" #include "cvfMath.h" - -#include "RiaDefines.h" -#include -#include #include "cvfVector3.h" +#include + +#include + //================================================================================================== /// Stores the info on a significant point in the well. Either a well-to-grid connection, or the /// bottom position of a connection less well-segment diff --git a/ApplicationCode/ReservoirDataModel/RigTofAccumulatedPhaseFractionsCalculator.cpp b/ApplicationCode/ReservoirDataModel/RigTofAccumulatedPhaseFractionsCalculator.cpp new file mode 100644 index 0000000000..1c3d0f7575 --- /dev/null +++ b/ApplicationCode/ReservoirDataModel/RigTofAccumulatedPhaseFractionsCalculator.cpp @@ -0,0 +1,137 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RigTofAccumulatedPhaseFractionsCalculator.h" + +#include "RiaDefines.h" +#include "RiaPorosityModel.h" + +#include "RigCaseCellResultsData.h" +#include "RigEclipseCaseData.h" +#include "RigFlowDiagResultAddress.h" +#include "RigFlowDiagResults.h" +#include "RigResultAccessor.h" +#include "RigResultAccessorFactory.h" +#include "RigSingleWellResultsData.h" + +#include "RimEclipseResultCase.h" +#include "RimFlowDiagSolution.h" +#include "RimReservoirCellResultsStorage.h" + +#include + + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigTofAccumulatedPhaseFractionsCalculator::RigTofAccumulatedPhaseFractionsCalculator(RimEclipseResultCase* caseToApply, + QString wellname, + size_t timestep) +{ + RigEclipseCaseData* eclipseCaseData = caseToApply->eclipseCaseData(); + RiaDefines::PorosityModelType porosityModel = RiaDefines::MATRIX_MODEL; + RimReservoirCellResultsStorage* gridCellResults = caseToApply->results(porosityModel); + + size_t scalarResultIndexSwat = gridCellResults->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "SWAT"); + size_t scalarResultIndexSoil = gridCellResults->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "SOIL"); + size_t scalarResultIndexSgas = gridCellResults->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "SGAS"); + size_t scalarResultIndexPorv = gridCellResults->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PORV"); + const std::vector* swatResults = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(scalarResultIndexSwat, timestep)); + const std::vector* soilResults = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(scalarResultIndexSoil, timestep)); + const std::vector* sgasResults = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(scalarResultIndexSgas, timestep)); + const std::vector* porvResults = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(scalarResultIndexPorv, timestep)); + + RimFlowDiagSolution* flowDiagSolution = caseToApply->defaultFlowDiagSolution(); + + std::string resultNameTof = "TOF"; + const std::vector* tofData = flowDiagSolution->flowDiagResults()->resultValues(RigFlowDiagResultAddress(resultNameTof, + RigFlowDiagResultAddress::PhaseSelection::PHASE_ALL, + wellname.toStdString()), + timestep); + + std::string resultNameFraction = "Fraction"; + const std::vector* fractionData = flowDiagSolution->flowDiagResults()->resultValues(RigFlowDiagResultAddress(resultNameFraction, + RigFlowDiagResultAddress::PhaseSelection::PHASE_ALL, + wellname.toStdString()), + timestep); + + sortTofAndCalculateAccPhaseFraction(tofData, + fractionData, + porvResults, + swatResults, + soilResults, + sgasResults, + m_accumulatedPhaseFractionSwat, + m_accumulatedPhaseFractionSoil, + m_accumulatedPhaseFractionSgas, + m_tofInIncreasingOrder); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigTofAccumulatedPhaseFractionsCalculator::sortTofAndCalculateAccPhaseFraction(const std::vector* tofData, + const std::vector* fractionData, + const std::vector* porvResults, + const std::vector* swatResults, + const std::vector* soilResults, + const std::vector* sgasResults, + std::vector& tofInIncreasingOrder, + std::vector& accumulatedPhaseFractionSwat, + std::vector& accumulatedPhaseFractionSoil, + std::vector& accumulatedPhaseFractionSgas) + +{ + std::map > tofAndIndexMap; + + for (int i = 0; i < static_cast(tofData->size()); i++) + { + std::vector vectorOfIndexes; + vectorOfIndexes.push_back(i); + + auto iteratorBoolFromInsertToMap = tofAndIndexMap.insert(std::make_pair(tofData->at(i), vectorOfIndexes)); + if (!iteratorBoolFromInsertToMap.second) + { + //Element exist already, was not inserted + iteratorBoolFromInsertToMap.first->second.push_back(i); + } + } + + double fractionPorvSum = 0.0; + double fractionPorvPhaseSumSwat = 0.0; + double fractionPorvPhaseSumSoil = 0.0; + double fractionPorvPhaseSumSgas = 0.0; + + for (auto element : tofAndIndexMap) + { + double tofValue = element.first; + for (int index : element.second) + { + fractionPorvSum += fractionData->at(index) * porvResults->at(index); + fractionPorvPhaseSumSwat += fractionData->at(index) * porvResults->at(index) * swatResults->at(index); + fractionPorvPhaseSumSoil += fractionData->at(index) * porvResults->at(index) * soilResults->at(index); + fractionPorvPhaseSumSgas += fractionData->at(index) * porvResults->at(index) * sgasResults->at(index); + } + + tofInIncreasingOrder.push_back(tofValue); + accumulatedPhaseFractionSwat.push_back(fractionPorvPhaseSumSwat / fractionPorvSum); + accumulatedPhaseFractionSoil.push_back(fractionPorvPhaseSumSoil / fractionPorvSum); + accumulatedPhaseFractionSgas.push_back(fractionPorvPhaseSumSgas / fractionPorvSum); + } +} \ No newline at end of file diff --git a/ApplicationCode/ReservoirDataModel/RigTofAccumulatedPhaseFractionsCalculator.h b/ApplicationCode/ReservoirDataModel/RigTofAccumulatedPhaseFractionsCalculator.h new file mode 100644 index 0000000000..fd05302fd2 --- /dev/null +++ b/ApplicationCode/ReservoirDataModel/RigTofAccumulatedPhaseFractionsCalculator.h @@ -0,0 +1,91 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include +#include + +class RimEclipseResultCase; +class QString; + +//================================================================================================== +/// +//================================================================================================== + +class RigTofAccumulatedPhaseFractionsCalculator +{ + +public: + explicit RigTofAccumulatedPhaseFractionsCalculator(RimEclipseResultCase* caseToApply, + QString wellname, + size_t timestep); + + const std::vector& sortedUniqueTOFValues() const { return m_tofInIncreasingOrder; } + const std::vector& accumulatedPhaseFractionsSwat() const { return m_accumulatedPhaseFractionSwat; } + const std::vector& accumulatedPhaseFractionsSoil() const { return m_accumulatedPhaseFractionSoil; } + const std::vector& accumulatedPhaseFractionsSgas() const { return m_accumulatedPhaseFractionSgas; } + + +private: + friend class RigTofAccumulatedPhaseFractionsCalculatorTester; + static void sortTofAndCalculateAccPhaseFraction(const std::vector* tofData, + const std::vector* fractionData, + const std::vector* porvResults, + const std::vector* swatResults, + const std::vector* soilResults, + const std::vector* sgasResults, + std::vector& tofInIncreasingOrder, + std::vector& accumulatedPhaseFractionSwat, + std::vector& accumulatedPhaseFractionSoil, + std::vector& accumulatedPhaseFractionSgas); + +private: + std::vector m_tofInIncreasingOrder; + std::vector m_accumulatedPhaseFractionSwat; + std::vector m_accumulatedPhaseFractionSgas; + std::vector m_accumulatedPhaseFractionSoil; + +}; + +class RigTofAccumulatedPhaseFractionsCalculatorTester +{ +public: + static void testSortTofAndCalculateAccPhaseFraction(const std::vector* tofData, + const std::vector* fractionData, + const std::vector* porvResults, + const std::vector* swatResults, + const std::vector* soilResults, + const std::vector* sgasResults, + std::vector& tofInIncreasingOrder, + std::vector& accumulatedPhaseFractionSwat, + std::vector& accumulatedPhaseFractionSoil, + std::vector& accumulatedPhaseFractionSgas) + { + RigTofAccumulatedPhaseFractionsCalculator::sortTofAndCalculateAccPhaseFraction(tofData, + fractionData, + porvResults, + swatResults, + soilResults, + sgasResults, + tofInIncreasingOrder, + accumulatedPhaseFractionSwat, + accumulatedPhaseFractionSoil, + accumulatedPhaseFractionSgas); + } +}; diff --git a/ApplicationCode/SocketInterface/RiaCaseInfoCommands.cpp b/ApplicationCode/SocketInterface/RiaCaseInfoCommands.cpp index 3d998de20c..1dc871fa6f 100644 --- a/ApplicationCode/SocketInterface/RiaCaseInfoCommands.cpp +++ b/ApplicationCode/SocketInterface/RiaCaseInfoCommands.cpp @@ -95,14 +95,14 @@ public: RimEclipseCase* rimCase = RiaSocketTools::findCaseFromArgs(server, args); if (!rimCase) return true; - RifReaderInterface::PorosityModelResultType porosityModel = RifReaderInterface::MATRIX_RESULTS; + RiaDefines::PorosityModelType porosityModel = RiaDefines::MATRIX_MODEL; if (args.size() > 2) { QString prorosityModelString = args[2]; if (prorosityModelString.toUpper() == "FRACTURE") { - porosityModel = RifReaderInterface::FRACTURE_RESULTS; + porosityModel = RiaDefines::FRACTURE_MODEL; } } @@ -144,7 +144,7 @@ public: return true; } - static void calculateMatrixModelActiveCellInfo(RimEclipseCase* reservoirCase, RifReaderInterface::PorosityModelResultType porosityModel, std::vector& gridNumber, std::vector& cellI, std::vector& cellJ, std::vector& cellK, std::vector& parentGridNumber, std::vector& hostCellI, std::vector& hostCellJ, std::vector& hostCellK, std::vector& globalCoarseningBoxIdx) + static void calculateMatrixModelActiveCellInfo(RimEclipseCase* reservoirCase, RiaDefines::PorosityModelType porosityModel, std::vector& gridNumber, std::vector& cellI, std::vector& cellJ, std::vector& cellK, std::vector& parentGridNumber, std::vector& hostCellI, std::vector& hostCellJ, std::vector& hostCellK, std::vector& globalCoarseningBoxIdx) { gridNumber.clear(); cellI.clear(); @@ -412,7 +412,7 @@ public: size_t scalarIndexWithMaxTimeStepCount = cvf::UNDEFINED_SIZE_T; if (rimCase && rimCase->eclipseCaseData()) { - rimCase->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->maxTimeStepCount(&scalarIndexWithMaxTimeStepCount); + rimCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->maxTimeStepCount(&scalarIndexWithMaxTimeStepCount); if (scalarIndexWithMaxTimeStepCount == cvf::UNDEFINED_SIZE_T) { canFetchData = false; @@ -431,7 +431,7 @@ public: return true; } - std::vector timeStepDates = rimCase->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->timeStepDates(scalarIndexWithMaxTimeStepCount); + std::vector timeStepDates = rimCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->timeStepDates(scalarIndexWithMaxTimeStepCount); quint64 timeStepCount = timeStepDates.size(); quint64 byteCount = sizeof(quint64) + 6 * timeStepCount * sizeof(qint32); @@ -499,7 +499,7 @@ public: size_t scalarIndexWithMaxTimeStepCount = cvf::UNDEFINED_SIZE_T; if (rimCase && rimCase->eclipseCaseData()) { - rimCase->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->maxTimeStepCount(&scalarIndexWithMaxTimeStepCount); + rimCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->maxTimeStepCount(&scalarIndexWithMaxTimeStepCount); if (scalarIndexWithMaxTimeStepCount == cvf::UNDEFINED_SIZE_T) { canFetchData = false; @@ -518,7 +518,7 @@ public: return true; } - std::vector daysSinceSimulationStart = rimCase->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->daysSinceSimulationStart(scalarIndexWithMaxTimeStepCount); + std::vector daysSinceSimulationStart = rimCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->daysSinceSimulationStart(scalarIndexWithMaxTimeStepCount); quint64 timeStepCount = daysSinceSimulationStart.size(); quint64 byteCount = sizeof(quint64) + timeStepCount * sizeof(qint32); diff --git a/ApplicationCode/SocketInterface/RiaGeometryCommands.cpp b/ApplicationCode/SocketInterface/RiaGeometryCommands.cpp index 096b41332a..6c25948d58 100644 --- a/ApplicationCode/SocketInterface/RiaGeometryCommands.cpp +++ b/ApplicationCode/SocketInterface/RiaGeometryCommands.cpp @@ -165,10 +165,10 @@ public: QString porosityModelName; porosityModelName = args[2]; - RifReaderInterface::PorosityModelResultType porosityModelEnum = RifReaderInterface::MATRIX_RESULTS; + RiaDefines::PorosityModelType porosityModelEnum = RiaDefines::MATRIX_MODEL; if (porosityModelName.toUpper() == "FRACTURE") { - porosityModelEnum = RifReaderInterface::FRACTURE_RESULTS; + porosityModelEnum = RiaDefines::FRACTURE_MODEL; } if (!rimCase || !rimCase->eclipseCaseData()) @@ -336,10 +336,10 @@ public: QString porosityModelName; porosityModelName = args[2]; - RifReaderInterface::PorosityModelResultType porosityModelEnum = RifReaderInterface::MATRIX_RESULTS; + RiaDefines::PorosityModelType porosityModelEnum = RiaDefines::MATRIX_MODEL; if (porosityModelName.toUpper() == "FRACTURE") { - porosityModelEnum = RifReaderInterface::FRACTURE_RESULTS; + porosityModelEnum = RiaDefines::FRACTURE_MODEL; } if (!rimCase || !rimCase->eclipseCaseData() ) diff --git a/ApplicationCode/SocketInterface/RiaPropertyDataCommands.cpp b/ApplicationCode/SocketInterface/RiaPropertyDataCommands.cpp index e3170f6a6b..383013f1c6 100644 --- a/ApplicationCode/SocketInterface/RiaPropertyDataCommands.cpp +++ b/ApplicationCode/SocketInterface/RiaPropertyDataCommands.cpp @@ -60,10 +60,10 @@ public: QString propertyName = args[2]; QString porosityModelName = args[3]; - RifReaderInterface::PorosityModelResultType porosityModelEnum = RifReaderInterface::MATRIX_RESULTS; + RiaDefines::PorosityModelType porosityModelEnum = RiaDefines::MATRIX_MODEL; if (porosityModelName == "Fracture") { - porosityModelEnum = RifReaderInterface::FRACTURE_RESULTS; + porosityModelEnum = RiaDefines::FRACTURE_MODEL; } // Find the requested data @@ -233,10 +233,10 @@ public: return true; } - RifReaderInterface::PorosityModelResultType porosityModelEnum = RifReaderInterface::MATRIX_RESULTS; + RiaDefines::PorosityModelType porosityModelEnum = RiaDefines::MATRIX_MODEL; if (porosityModelName == "Fracture") { - porosityModelEnum = RifReaderInterface::FRACTURE_RESULTS; + porosityModelEnum = RiaDefines::FRACTURE_MODEL; } size_t scalarResultIndex = cvf::UNDEFINED_SIZE_T; @@ -383,7 +383,7 @@ public: m_bytesPerTimeStepToRead(0), m_currentTimeStepNumberToRead(0), m_invalidActiveCellCountDetected(false), - m_porosityModelEnum(RifReaderInterface::MATRIX_RESULTS) + m_porosityModelEnum(RiaDefines::MATRIX_MODEL) {} static QString commandName () { return QString("SetActiveCellProperty"); } @@ -397,7 +397,7 @@ public: if (porosityModelName == "Fracture") { - m_porosityModelEnum = RifReaderInterface::FRACTURE_RESULTS; + m_porosityModelEnum = RiaDefines::FRACTURE_MODEL; } // Find the requested data, Or create a set if we are setting data and it is not found @@ -697,7 +697,7 @@ private: size_t m_currentScalarIndex; QString m_currentPropertyName; std::vector m_requestedTimesteps; - RifReaderInterface::PorosityModelResultType m_porosityModelEnum; + RiaDefines::PorosityModelType m_porosityModelEnum; quint64 m_timeStepCountToRead; quint64 m_bytesPerTimeStepToRead; @@ -724,7 +724,7 @@ public: m_bytesPerTimeStepToRead(0), m_currentTimeStepNumberToRead(0), m_invalidDataDetected(false), - m_porosityModelEnum(RifReaderInterface::MATRIX_RESULTS) + m_porosityModelEnum(RiaDefines::MATRIX_MODEL) {} static QString commandName () { return QString("SetGridProperty"); } @@ -746,7 +746,7 @@ public: if (porosityModelName == "Fracture") { - m_porosityModelEnum = RifReaderInterface::FRACTURE_RESULTS; + m_porosityModelEnum = RiaDefines::FRACTURE_MODEL; } RigGridBase* grid = rimCase->eclipseCaseData()->grid(m_currentGridIndex); @@ -1061,7 +1061,7 @@ private: size_t m_currentScalarIndex; QString m_currentPropertyName; std::vector m_requestedTimesteps; - RifReaderInterface::PorosityModelResultType m_porosityModelEnum; + RiaDefines::PorosityModelType m_porosityModelEnum; quint64 m_timeStepCountToRead; quint64 m_bytesPerTimeStepToRead; @@ -1092,11 +1092,11 @@ public: } QString porosityModelName = args[2]; - RifReaderInterface::PorosityModelResultType porosityModelEnum = RifReaderInterface::MATRIX_RESULTS; + RiaDefines::PorosityModelType porosityModelEnum = RiaDefines::MATRIX_MODEL; if (porosityModelName == "Fracture") { - porosityModelEnum = RifReaderInterface::FRACTURE_RESULTS; + porosityModelEnum = RiaDefines::FRACTURE_MODEL; } std::vector propNames; diff --git a/ApplicationCode/UnitTests/CMakeLists_files.cmake b/ApplicationCode/UnitTests/CMakeLists_files.cmake index 9acf8bdc9a..3264fb8f06 100644 --- a/ApplicationCode/UnitTests/CMakeLists_files.cmake +++ b/ApplicationCode/UnitTests/CMakeLists_files.cmake @@ -24,6 +24,7 @@ ${CEE_CURRENT_LIST_DIR}RivTernaryScalarMapper-Test.cpp ${CEE_CURRENT_LIST_DIR}ScalarMapper-Test.cpp ${CEE_CURRENT_LIST_DIR}WellPathAsciiFileReader-Test.cpp ${CEE_CURRENT_LIST_DIR}opm-flowdiagnostics-Test.cpp +${CEE_CURRENT_LIST_DIR}RigTofAccumulatedPhaseFractionsCalculator-Test.cpp ${CEE_CURRENT_LIST_DIR}RigCellGeometryTools-Test.cpp ${CEE_CURRENT_LIST_DIR}RigTransmissibilityCondenser-Test.cpp ${CEE_CURRENT_LIST_DIR}RigHexIntersectionTools-Test.cpp diff --git a/ApplicationCode/UnitTests/RifReaderEclipseOutput-Test.cpp b/ApplicationCode/UnitTests/RifReaderEclipseOutput-Test.cpp index 7b1a14da6b..3a50dd2172 100644 --- a/ApplicationCode/UnitTests/RifReaderEclipseOutput-Test.cpp +++ b/ApplicationCode/UnitTests/RifReaderEclipseOutput-Test.cpp @@ -260,7 +260,7 @@ TEST(RigReservoirTest, UnifiedTestFile) -void buildResultInfoString(RigReservoir* reservoir, RifReaderInterface::PorosityModelResultType porosityModel, RiaDefines::ResultCatType resultType) +void buildResultInfoString(RigReservoir* reservoir, RiaDefines::PorosityModelType porosityModel, RiaDefines::ResultCatType resultType) { RigCaseCellResultsData* matrixResults = reservoir->results(porosityModel); { @@ -302,22 +302,22 @@ TEST(RigReservoirTest, DualPorosityTest) qDebug() << "\n\n" << "Matrix porosities, DYNAMIC results" << "----------------------------------"; - buildResultInfoString(reservoir.p(), RifReaderInterface::MATRIX_RESULTS, RiaDefines::DYNAMIC_NATIVE); + buildResultInfoString(reservoir.p(), RiaDefines::MATRIX_MODEL, RiaDefines::DYNAMIC_NATIVE); qDebug() << "\n\n" << "Matrix porosities, STATIC results" << "----------------------------------"; - buildResultInfoString(reservoir.p(), RifReaderInterface::MATRIX_RESULTS, RiaDefines::STATIC_NATIVE); + buildResultInfoString(reservoir.p(), RiaDefines::MATRIX_MODEL, RiaDefines::STATIC_NATIVE); qDebug() << "\n\n" << "Fracture porosities, DYNAMIC results" << "----------------------------------"; - buildResultInfoString(reservoir.p(), RifReaderInterface::FRACTURE_RESULTS, RiaDefines::DYNAMIC_NATIVE); + buildResultInfoString(reservoir.p(), RiaDefines::FRACTURE_MODEL, RiaDefines::DYNAMIC_NATIVE); qDebug() << "\n\n" << "Fracture porosities, STATIC results" << "----------------------------------"; - buildResultInfoString(reservoir.p(), RifReaderInterface::FRACTURE_RESULTS, RiaDefines::STATIC_NATIVE); + buildResultInfoString(reservoir.p(), RiaDefines::FRACTURE_MODEL, RiaDefines::STATIC_NATIVE); } diff --git a/ApplicationCode/UnitTests/RigTofAccumulatedPhaseFractionsCalculator-Test.cpp b/ApplicationCode/UnitTests/RigTofAccumulatedPhaseFractionsCalculator-Test.cpp new file mode 100644 index 0000000000..d4ddbf71cb --- /dev/null +++ b/ApplicationCode/UnitTests/RigTofAccumulatedPhaseFractionsCalculator-Test.cpp @@ -0,0 +1,159 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// +#include "gtest/gtest.h" + +#include "RigTofAccumulatedPhaseFractionsCalculator.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +TEST(RigTofAccumulatedPhaseFractionsCalculator, sortTofAndCalculateAccPhaseFractionTest) +{ + std::vector tofDataVector; + tofDataVector.push_back(0.001); + tofDataVector.push_back(0.1); + tofDataVector.push_back(0.01); + + std::vector fractionDataVector; + fractionDataVector.push_back(0.002); + fractionDataVector.push_back(0.2); + fractionDataVector.push_back(0.02); + + std::vector porvResultVector; + porvResultVector.push_back(1); + porvResultVector.push_back(1); + porvResultVector.push_back(1.5); + + std::vector swatResultVector; + swatResultVector.push_back(0.1); + swatResultVector.push_back(0.3); + swatResultVector.push_back(0.6); + + std::vector soilResultVector; + soilResultVector.push_back(0.3); + soilResultVector.push_back(0.6); + soilResultVector.push_back(0.1); + + std::vector sgasResultVector; + sgasResultVector.push_back(0.6); + sgasResultVector.push_back(0.1); + sgasResultVector.push_back(0.3); + + + std::vector accumulatedPhaseFractionSwat; + std::vector accumulatedPhaseFractionSoil; + std::vector accumulatedPhaseFractionSgas; + std::vector tofInIncreasingOrder; + + RigTofAccumulatedPhaseFractionsCalculatorTester::testSortTofAndCalculateAccPhaseFraction(&(tofDataVector), + &(fractionDataVector), + &(porvResultVector), + &(swatResultVector), + &(soilResultVector), + &(sgasResultVector), + tofInIncreasingOrder, + accumulatedPhaseFractionSwat, + accumulatedPhaseFractionSoil, + accumulatedPhaseFractionSgas + ); + + EXPECT_LT(tofInIncreasingOrder[0], tofInIncreasingOrder[1]); + EXPECT_LT(tofInIncreasingOrder[1], tofInIncreasingOrder[2]); + + double sumForOneTOF = accumulatedPhaseFractionSwat[2] + + accumulatedPhaseFractionSoil[2] + + accumulatedPhaseFractionSgas[2]; + EXPECT_DOUBLE_EQ(sumForOneTOF, 1.00); + + EXPECT_DOUBLE_EQ(accumulatedPhaseFractionSwat[0], 0.1000); + EXPECT_DOUBLE_EQ(accumulatedPhaseFractionSoil[1], 0.1125); + EXPECT_LT(accumulatedPhaseFractionSgas[2] - 0.13017, 0.00001); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +TEST(RigTofAccumulatedPhaseFractionsCalculator, sortTofAndCalculateAccPhaseFractionTest2) +{ + std::vector tofDataVector2; + tofDataVector2.push_back(0.001); + tofDataVector2.push_back(0.1); + tofDataVector2.push_back(0.01); + tofDataVector2.push_back(0.1); + + std::vector fractionDataVector2; + fractionDataVector2.push_back(0.002); + fractionDataVector2.push_back(0.2); + fractionDataVector2.push_back(0.02); + fractionDataVector2.push_back(0.02); + + std::vector porvResultVector2; + porvResultVector2.push_back(1); + porvResultVector2.push_back(1); + porvResultVector2.push_back(1.5); + porvResultVector2.push_back(1.5); + + std::vector swatResultVector2; + swatResultVector2.push_back(0.1); + swatResultVector2.push_back(0.3); + swatResultVector2.push_back(0.6); + swatResultVector2.push_back(0.6); + + std::vector soilResultVector2; + soilResultVector2.push_back(0.3); + soilResultVector2.push_back(0.6); + soilResultVector2.push_back(0.1); + soilResultVector2.push_back(0.1); + + std::vector sgasResultVector2; + sgasResultVector2.push_back(0.6); + sgasResultVector2.push_back(0.1); + sgasResultVector2.push_back(0.3); + sgasResultVector2.push_back(0.3); + + std::vector accumulatedPhaseFractionSwat2; + std::vector accumulatedPhaseFractionSoil2; + std::vector accumulatedPhaseFractionSgas2; + std::vector tofInIncreasingOrder2; + + RigTofAccumulatedPhaseFractionsCalculatorTester::testSortTofAndCalculateAccPhaseFraction(&(tofDataVector2), + &(fractionDataVector2), + &(porvResultVector2), + &(swatResultVector2), + &(soilResultVector2), + &(sgasResultVector2), + tofInIncreasingOrder2, + accumulatedPhaseFractionSwat2, + accumulatedPhaseFractionSoil2, + accumulatedPhaseFractionSgas2); + EXPECT_EQ(tofInIncreasingOrder2.size(), 3); + + double sumForOneTOF = accumulatedPhaseFractionSwat2[2] + + accumulatedPhaseFractionSoil2[2] + + accumulatedPhaseFractionSgas2[2]; + EXPECT_DOUBLE_EQ(sumForOneTOF, 1.00); + + EXPECT_LT(tofInIncreasingOrder2[0], tofInIncreasingOrder2[1]); + EXPECT_LT(tofInIncreasingOrder2[1], tofInIncreasingOrder2[2]); + + EXPECT_DOUBLE_EQ(accumulatedPhaseFractionSwat2[0], 0.1000); + EXPECT_DOUBLE_EQ(accumulatedPhaseFractionSoil2[1], 0.1125); + EXPECT_LT(accumulatedPhaseFractionSgas2[2] - 0.149618, 0.00001); + +} + diff --git a/ApplicationCode/UserInterface/RiuResultTextBuilder.cpp b/ApplicationCode/UserInterface/RiuResultTextBuilder.cpp index af72cc90c4..bc8620360b 100644 --- a/ApplicationCode/UserInterface/RiuResultTextBuilder.cpp +++ b/ApplicationCode/UserInterface/RiuResultTextBuilder.cpp @@ -374,7 +374,7 @@ void RiuResultTextBuilder::appendTextFromResultColors(RigEclipseCaseData* eclips return; } - RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(resultColors->porosityModel()); + RiaDefines::PorosityModelType porosityModel = resultColors->porosityModel(); if (resultColors->isTernarySaturationSelected()) { RimReservoirCellResultsStorage* gridCellResults = resultColors->currentGridCellResults(); @@ -407,8 +407,6 @@ void RiuResultTextBuilder::appendTextFromResultColors(RigEclipseCaseData* eclips } else if (resultColors->hasResult()) { - RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(resultColors->porosityModel()); - if (resultColors->hasStaticResult()) { if (resultColors->resultVariable().compare(RiaDefines::combinedTransmissibilityResultName(), Qt::CaseInsensitive) == 0) @@ -539,7 +537,7 @@ QString RiuResultTextBuilder::cellEdgeResultDetails() adjustedTimeStep = 0; } - RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_reservoirView->cellResult()->porosityModel()); + RiaDefines::PorosityModelType porosityModel = m_reservoirView->cellResult()->porosityModel(); cvf::ref resultAccessor = RigResultAccessorFactory::createFromResultIdx(m_reservoirView->eclipseCase()->eclipseCaseData(), m_gridIndex, porosityModel, adjustedTimeStep, resultIndex); if (resultAccessor.notNull()) { @@ -666,7 +664,7 @@ QString RiuResultTextBuilder::cellResultText(RimEclipseCellColors* resultColors) size_t sgasScalarSetIndex = gridCellResults->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "SGAS"); size_t swatScalarSetIndex = gridCellResults->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "SWAT"); - RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(resultColors->porosityModel()); + RiaDefines::PorosityModelType porosityModel = resultColors->porosityModel(); cvf::ref dataAccessObjectX = RigResultAccessorFactory::createFromResultIdx(eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, soilScalarSetIndex); cvf::ref dataAccessObjectY = RigResultAccessorFactory::createFromResultIdx(eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, sgasScalarSetIndex); diff --git a/ApplicationCode/UserInterface/RiuSelectionChangedHandler.cpp b/ApplicationCode/UserInterface/RiuSelectionChangedHandler.cpp index 11ad19921e..b1271ccf50 100644 --- a/ApplicationCode/UserInterface/RiuSelectionChangedHandler.cpp +++ b/ApplicationCode/UserInterface/RiuSelectionChangedHandler.cpp @@ -113,7 +113,7 @@ void RiuSelectionChangedHandler::addCurveFromSelectionItem(const RiuEclipseSelec eclipseView->eclipseCase() && eclipseView->eclipseCase()->eclipseCaseData()) { - RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(eclipseView->cellResult()->porosityModel()); + RiaDefines::PorosityModelType porosityModel = eclipseView->cellResult()->porosityModel(); std::vector timeStepDates = eclipseView->eclipseCase()->eclipseCaseData()->results(porosityModel)->timeStepDates(); diff --git a/doc/eclipse_binary_file_classes.plantuml b/doc/eclipse_binary_file_classes.plantuml new file mode 100644 index 0000000000..eb7fd1585a --- /dev/null +++ b/doc/eclipse_binary_file_classes.plantuml @@ -0,0 +1,31 @@ +@startuml + +class RifReaderInterface { +virtual open() +virtual close() +virtual staticResult() +virtual dynamicResult() +virtual timeSteps() +} + +RifEclipseRestartDataAccess <|- RifEclipseRestartFilesetAccess +RifEclipseRestartDataAccess <|- RifEclipseUnifiedRestartFileAccess + +RifReaderInterface <|- RifReaderEclipseOutput + +class RifEclipseOutputFileTools { +helper class with several static functions +used to read data from Eclipse binary files +} + + +RifReaderEclipseOutput o-- "1..N" RifEclipseRestartDataAccess + + +RifEclipseRestartFilesetAccess --o RifEclipseOutputFileTools : uses +RifEclipseUnifiedRestartFileAccess --o RifEclipseOutputFileTools : uses + +ecl_file_type "N" o-- RifEclipseRestartFilesetAccess +ecl_file_type "1" o-- RifEclipseUnifiedRestartFileAccess + +@enduml