#1602 Include sim well fractures when calculating completion type results

This commit is contained in:
Bjørnar Grip Fjær 2017-06-21 11:06:38 +02:00
parent 7d5157b3b3
commit 17593fba92
11 changed files with 105 additions and 22 deletions

View File

@ -2748,8 +2748,31 @@ void RiaApplication::scheduleDisplayModelUpdateAndRedraw(RimView* resViewToUpdat
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaApplication::scheduleRecalculateCompletionTypeAndRedraw()
void RiaApplication::scheduleRecalculateCompletionTypeAndRedrawAllViews()
{
for (RimEclipseCase* eclipseCase : project()->activeOilField()->analysisModels->cases())
{
m_eclipseCasesToRecalculate.push_back(eclipseCase);
}
if (!m_recalculateCompletionTypeTimer)
{
m_recalculateCompletionTypeTimer = new QTimer(this);
m_recalculateCompletionTypeTimer->setSingleShot(true);
connect(m_recalculateCompletionTypeTimer, SIGNAL(timeout()), this, SLOT(slotRecaulculateCompletionType()));
}
m_recalculateCompletionTypeTimer->start(500);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaApplication::scheduleRecalculateCompletionTypeAndRedrawEclipseCase(RimEclipseCase* eclipseCase)
{
m_eclipseCasesToRecalculate.push_back(eclipseCase);
if (!m_recalculateCompletionTypeTimer)
{
m_recalculateCompletionTypeTimer = new QTimer(this);
@ -2805,10 +2828,14 @@ void RiaApplication::slotUpdateScheduledDisplayModels()
//--------------------------------------------------------------------------------------------------
void RiaApplication::slotRecaulculateCompletionType()
{
for (RimEclipseCase* eclipseCase : project()->activeOilField()->analysisModels->cases())
std::set<RimEclipseCase*> uniqueCases(m_eclipseCasesToRecalculate.begin(), m_eclipseCasesToRecalculate.end());
for (RimEclipseCase* eclipseCase : uniqueCases)
{
eclipseCase->recalculateCompletionTypeAndRedrawAllViews();
}
m_eclipseCasesToRecalculate.clear();
}
//--------------------------------------------------------------------------------------------------

View File

@ -99,7 +99,8 @@ public:
RimViewWindow* activePlotWindow() const;
void scheduleDisplayModelUpdateAndRedraw(RimView* resViewToUpdate);
void scheduleRecalculateCompletionTypeAndRedraw();
void scheduleRecalculateCompletionTypeAndRedrawAllViews();
void scheduleRecalculateCompletionTypeAndRedrawEclipseCase(RimEclipseCase* eclipseCase);
RimProject* project();
@ -240,6 +241,7 @@ private:
std::vector<caf::PdmPointer<RimView> > m_resViewsToUpdate;
QTimer* m_resViewUpdateTimer;
std::vector<caf::PdmPointer<RimEclipseCase> > m_eclipseCasesToRecalculate;
QTimer* m_recalculateCompletionTypeTimer;
RiaSocketServer* m_socketServer;

View File

@ -83,9 +83,11 @@ void RicNewSimWellFractureAtPosFeature::onActionTriggered(bool isChecked)
fracture->setName(QString("Fracture_") + fracNum);
RimEclipseResultCase* eclipseCase = nullptr;
simWell->firstAncestorOrThisOfType(eclipseCase);
fracture->setFractureUnit(eclipseCase->eclipseCaseData()->unitsType());
{
RimEclipseResultCase* eclipseCase = nullptr;
simWell->firstAncestorOrThisOfType(eclipseCase);
fracture->setFractureUnit(eclipseCase->eclipseCaseData()->unitsType());
}
if (oilfield->fractureDefinitionCollection->fractureDefinitions.size() > 0)
{
@ -97,6 +99,15 @@ void RicNewSimWellFractureAtPosFeature::onActionTriggered(bool isChecked)
RiuMainWindow::instance()->selectAsCurrentItem(fracture);
activeView->scheduleCreateDisplayModelAndRedraw();
RimEclipseCase* eclipseCase = nullptr;
simWell->firstAncestorOrThisOfType(eclipseCase);
if (eclipseCase)
{
RimProject* project;
eclipseCase->firstAncestorOrThisOfTypeAsserted(project);
project->reloadCompletionTypeResultsForEclipseCase(eclipseCase);
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -31,6 +31,7 @@
#include "RimProject.h"
#include "RimSimWellFracture.h"
#include "RimSimWellFractureCollection.h"
#include "RimEclipseCase.h"
#include "RiuMainWindow.h"
@ -69,9 +70,11 @@ void RicNewSimWellFractureFeature::onActionTriggered(bool isChecked)
fracture->setName(QString("Fracture_") + fracNum);
RimEclipseResultCase* eclipseCase = nullptr;
objHandle->firstAncestorOrThisOfType(eclipseCase);
fracture->setFractureUnit(eclipseCase->eclipseCaseData()->unitsType());
{
RimEclipseResultCase* eclipseCase = nullptr;
objHandle->firstAncestorOrThisOfType(eclipseCase);
fracture->setFractureUnit(eclipseCase->eclipseCaseData()->unitsType());
}
if (oilfield->fractureDefinitionCollection->fractureDefinitions.size() > 0)
{
@ -84,10 +87,14 @@ void RicNewSimWellFractureFeature::onActionTriggered(bool isChecked)
eclipseWell->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(fracture);
RimEclipseView* mainView = nullptr;
objHandle->firstAncestorOrThisOfType(mainView);
if (mainView) mainView->scheduleCreateDisplayModelAndRedraw();
RimEclipseCase* eclipseCase = nullptr;
objHandle->firstAncestorOrThisOfType(eclipseCase);
if (eclipseCase)
{
RimProject* project;
objHandle->firstAncestorOrThisOfTypeAsserted(project);
project->reloadCompletionTypeResultsForEclipseCase(eclipseCase);
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -85,11 +85,11 @@ void RicNewWellPathFractureFeature::addFracture(RimWellPath* wellPath, double me
wellPath->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(fracture);
RimWellPathCollection* wellPathColl = nullptr;
fractureCollection->firstAncestorOrThisOfType(wellPathColl);
if (wellPathColl)
RimProject* project = nullptr;
fractureCollection->firstAncestorOrThisOfType(project);
if (project)
{
wellPathColl->scheduleGeometryRegenAndRedrawViews();
project->reloadCompletionTypeResultsInAllViews();
}
}

View File

@ -32,6 +32,12 @@
#include "RimWellPathFracture.h"
#include "RimFractureTemplate.h"
#include "RimWellPathFractureCollection.h"
#include "RimEclipseCase.h"
#include "RimEclipseView.h"
#include "RimEclipseWellCollection.h"
#include "RimEclipseWell.h"
#include "RimSimWellFractureCollection.h"
#include "RimSimWellFracture.h"
#include "RigMainGrid.h"
#include "RigWellPath.h"
@ -45,7 +51,7 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCompletionCellIntersectionCalc::calculateIntersections(const RimProject* project, const RigMainGrid* grid, std::vector<double>& values, const QDateTime& fromDate)
void RimCompletionCellIntersectionCalc::calculateIntersections(const RimProject* project, const RimEclipseCase* eclipseCase, const RigMainGrid* grid, std::vector<double>& values, const QDateTime& fromDate)
{
for (const RimWellPath* wellPath : project->activeOilField()->wellPathCollection->wellPaths)
{
@ -54,6 +60,17 @@ void RimCompletionCellIntersectionCalc::calculateIntersections(const RimProject*
calculateWellPathIntersections(wellPath, grid, values, fromDate);
}
}
for (RimEclipseView* view : eclipseCase->reservoirViews())
{
for (RimEclipseWell* simWell : view->wellCollection()->wells())
{
for (RimSimWellFracture* fracture : simWell->simwellFractureCollection()->simwellFractures())
{
calculateFractureIntersections(grid, fracture, values);
}
}
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -25,6 +25,7 @@ class RimWellPath;
class RimFishbonesMultipleSubs;
class RimPerforationInterval;
class RimFracture;
class RimEclipseCase;
class RigMainGrid;
class QDateTime;
@ -36,7 +37,7 @@ class QDateTime;
class RimCompletionCellIntersectionCalc
{
public:
static void calculateIntersections(const RimProject* project, const RigMainGrid* grid, std::vector<double>& values, const QDateTime& fromDate);
static void calculateIntersections(const RimProject* project, const RimEclipseCase* eclipseCase, const RigMainGrid* grid, std::vector<double>& values, const QDateTime& fromDate);
private:
static void calculateWellPathIntersections(const RimWellPath* wellPath, const RigMainGrid* grid, std::vector<double>& values, const QDateTime& fromDate);

View File

@ -147,7 +147,7 @@ void RimSimWellFracture::fieldChangedByUi(const caf::PdmFieldHandle* changedFiel
RimProject* proj;
this->firstAncestorOrThisOfType(proj);
if (proj) proj->createDisplayModelAndRedrawAllViews();
if (proj) proj->reloadCompletionTypeResultsInAllViews();
}
}

View File

@ -770,7 +770,22 @@ bool RimProject::showPlotWindow() const
void RimProject::reloadCompletionTypeResultsInAllViews()
{
createDisplayModelAndRedrawAllViews();
RiaApplication::instance()->scheduleRecalculateCompletionTypeAndRedraw();
RiaApplication::instance()->scheduleRecalculateCompletionTypeAndRedrawAllViews();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimProject::reloadCompletionTypeResultsForEclipseCase(RimEclipseCase* eclipseCase)
{
std::vector<RimView*> views = eclipseCase->views();
for (size_t viewIdx = 0; viewIdx < views.size(); viewIdx++)
{
views[viewIdx]->scheduleCreateDisplayModelAndRedraw();
}
RiaApplication::instance()->scheduleRecalculateCompletionTypeAndRedrawEclipseCase(eclipseCase);
}
//--------------------------------------------------------------------------------------------------

View File

@ -111,6 +111,7 @@ public:
bool showPlotWindow() const;
void reloadCompletionTypeResultsInAllViews();
void reloadCompletionTypeResultsForEclipseCase(RimEclipseCase* eclipseCase);
protected:

View File

@ -363,10 +363,12 @@ size_t RimReservoirCellResultsStorage::findOrLoadScalarResult(RiaDefines::Result
}
else if (resultName == RiaDefines::completionTypeResultName())
{
caf::ProgressInfo progressInfo(m_cellResults->maxTimeStepCount(), "Calculate Completion Type Results");
m_cellResults->cellScalarResults(scalarResultIndex).resize(m_cellResults->maxTimeStepCount());
for (size_t timeStepIdx = 0; timeStepIdx < m_cellResults->maxTimeStepCount(); ++timeStepIdx)
{
computeCompletionTypeForTimeStep(timeStepIdx);
progressInfo.incrementProgress();
}
}
@ -1429,7 +1431,7 @@ void RimReservoirCellResultsStorage::computeCompletionTypeForTimeStep(size_t tim
firstAncestorOrThisOfTypeAsserted(eclipseCase);
QDateTime timeStepDate = eclipseCase->timeStepDates()[timeStep];
RimCompletionCellIntersectionCalc::calculateIntersections(project, m_ownerMainGrid, completionTypeResult, timeStepDate);
RimCompletionCellIntersectionCalc::calculateIntersections(project, eclipseCase, m_ownerMainGrid, completionTypeResult, timeStepDate);
}
//--------------------------------------------------------------------------------------------------