From 84dcc0980e4a983cce1b0fa5d3f74624729e1028 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Fri, 8 Dec 2017 16:38:58 +0100 Subject: [PATCH] #2237 Progress bar when calculating flooded PV Fix errors in progress detected when opening project --- .../Application/RiaApplication.cpp | 25 ++++++------ .../FileInterface/RifReaderEclipseOutput.cpp | 2 +- ...igNumberOfFloodedPoreVolumesCalculator.cpp | 39 ++++++++++++++++--- 3 files changed, 47 insertions(+), 19 deletions(-) diff --git a/ApplicationCode/Application/RiaApplication.cpp b/ApplicationCode/Application/RiaApplication.cpp index 9ed618bcd1..8e4a58f33b 100644 --- a/ApplicationCode/Application/RiaApplication.cpp +++ b/ApplicationCode/Application/RiaApplication.cpp @@ -558,24 +558,25 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi caseProgress.setProgressDescription(cas->caseUserDescription()); std::vector views = cas->views(); - caf::ProgressInfo viewProgress(views.size(), "Creating Views"); + { // To delete the view progress before incrementing the caseProgress + caf::ProgressInfo viewProgress(views.size(), "Creating Views"); - size_t j; - for (j = 0; j < views.size(); j++) - { - RimView* riv = views[j]; - CVF_ASSERT(riv); + size_t j; + for ( j = 0; j < views.size(); j++ ) + { + RimView* riv = views[j]; + CVF_ASSERT(riv); - viewProgress.setProgressDescription(riv->name()); + viewProgress.setProgressDescription(riv->name()); - riv->loadDataAndUpdate(); - this->setActiveReservoirView(riv); + riv->loadDataAndUpdate(); + this->setActiveReservoirView(riv); - riv->rangeFilterCollection()->updateIconState(); + riv->rangeFilterCollection()->updateIconState(); - viewProgress.incrementProgress(); + viewProgress.incrementProgress(); + } } - caseProgress.incrementProgress(); } } diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp index 67ba54dbac..f9e0714f78 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp @@ -410,7 +410,7 @@ bool RifReaderEclipseOutput::open(const QString& fileName, RigEclipseCaseData* e if (isNNCsEnabled()) { progInfo.setProgressDescription("Reading NNC data"); - progInfo.setNextProgressIncrement(5); + progInfo.setNextProgressIncrement(4); transferStaticNNCData(mainEclGrid, m_ecl_init_file, eclipseCase->mainGrid()); progInfo.incrementProgress(); diff --git a/ApplicationCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp b/ApplicationCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp index cb507aadf4..065270c68c 100644 --- a/ApplicationCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp +++ b/ApplicationCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp @@ -31,6 +31,7 @@ #include #include +#include "cafProgressInfo.h" //-------------------------------------------------------------------------------------------------- @@ -47,28 +48,42 @@ RigNumberOfFloodedPoreVolumesCalculator::RigNumberOfFloodedPoreVolumesCalculator RigActiveCellInfo* actCellInfo = caseToApply->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL); size_t resultCellCount = actCellInfo->reservoirCellResultCount(); + size_t timeStepCount = caseToApply->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->maxTimeStepCount(); + size_t totalProgress = tracerNames.size() + + 8 + + timeStepCount + + 2* timeStepCount; + caf::ProgressInfo progress(totalProgress, "Calculating number of flooded mobile pore volumes." ); + progress.setProgressDescription("Loading required results"); // PORV const std::vector* porvResults = nullptr; std::vector porvActiveCellsResultStorage; porvResults = RigCaseCellResultsData::getResultIndexableStaticResult(actCellInfo, gridCellResults, "PORV", porvActiveCellsResultStorage); + progress.incrementProgress(); + // SWCR if defined const std::vector* swcrResults = nullptr; swcrResults = RigCaseCellResultsData::getResultIndexableStaticResult(actCellInfo, gridCellResults, "SWCR", porvActiveCellsResultStorage); + progress.incrementProgress(); std::vector scalarResultIndexTracers; for (QString tracerName : tracerNames) { scalarResultIndexTracers.push_back(gridCellResults->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, tracerName)); + progress.incrementProgress(); } std::vector > summedTracersAtAllTimesteps; //TODO: Option for Oil and Gas instead of water - size_t scalarResultIndexFlowrateI = gridCellResults->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "FLRWATI+"); - size_t scalarResultIndexFlowrateJ = gridCellResults->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "FLRWATJ+"); - size_t scalarResultIndexFlowrateK = gridCellResults->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "FLRWATK+"); + size_t scalarResultIndexFlowrateI = gridCellResults->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "FLRWATI+"); + progress.incrementProgress(); + size_t scalarResultIndexFlowrateJ = gridCellResults->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "FLRWATJ+"); + progress.incrementProgress(); + size_t scalarResultIndexFlowrateK = gridCellResults->findOrLoadScalarResult(RiaDefines::DYNAMIC_NATIVE, "FLRWATK+"); + progress.incrementProgress(); std::vector* > flowrateIatAllTimeSteps; std::vector* > flowrateJatAllTimeSteps; @@ -76,13 +91,18 @@ RigNumberOfFloodedPoreVolumesCalculator::RigNumberOfFloodedPoreVolumesCalculator RigNNCData* nncData = eclipseCaseData->mainGrid()->nncData(); const std::vector connections = nncData->connections(); + + progress.incrementProgress(); //TODO: oil or gas flowrate std::vector* > flowrateNNCatAllTimeSteps; QString nncConnectionProperty = mainGrid->nncData()->propertyNameFluxWat(); - - std::vector daysSinceSimulationStart = caseToApply->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->daysSinceSimulationStart(); + progress.incrementProgress(); + + std::vector daysSinceSimulationStart = caseToApply->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->daysSinceSimulationStart(); + + progress.incrementProgress(); for (size_t timeStep = 0; timeStep < daysSinceSimulationStart.size(); timeStep++) { @@ -133,9 +153,13 @@ RigNumberOfFloodedPoreVolumesCalculator::RigNumberOfFloodedPoreVolumesCalculator } } summedTracersAtAllTimesteps.push_back(summedTracerValues); - + + progress.incrementProgress(); } + progress.setNextProgressIncrement(2*timeStepCount); + progress.setProgressDescription("Calculating"); + calculate(mainGrid, caseToApply, daysSinceSimulationStart, @@ -178,6 +202,7 @@ void RigNumberOfFloodedPoreVolumesCalculator::calculate(RigMainGrid* mainGrid, RigActiveCellInfo* actCellInfo = caseToApply->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL); size_t resultCellCount = actCellInfo->reservoirCellResultCount(); + caf::ProgressInfo progress(2*daysSinceSimulationStart.size() , ""); std::vector> cellQwInAtAllTimeSteps; std::vector cellQwInTimeStep0(resultCellCount); @@ -233,6 +258,7 @@ void RigNumberOfFloodedPoreVolumesCalculator::calculate(RigMainGrid* mainGrid, } cellQwInAtAllTimeSteps.push_back(CellQwIn); + progress.incrementProgress(); } @@ -257,6 +283,7 @@ void RigNumberOfFloodedPoreVolumesCalculator::calculate(RigMainGrid* mainGrid, / scaledPoreVolume; } m_cumWinflowPVAllTimeSteps.push_back(cumWinflowPV); + progress.incrementProgress(); } }