mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4683 clang-format on all files in ApplicationCode
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017- Statoil ASA
|
||||
//
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -29,408 +29,406 @@
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
|
||||
#include <vector>
|
||||
#include <QString>
|
||||
#include "cafProgressInfo.h"
|
||||
|
||||
#include <QString>
|
||||
#include <vector>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigNumberOfFloodedPoreVolumesCalculator::RigNumberOfFloodedPoreVolumesCalculator(RimEclipseCase* caseToApply,
|
||||
const std::vector<QString> tracerNames)
|
||||
RigNumberOfFloodedPoreVolumesCalculator::RigNumberOfFloodedPoreVolumesCalculator( RimEclipseCase* caseToApply,
|
||||
const std::vector<QString> tracerNames )
|
||||
{
|
||||
RigMainGrid* mainGrid = caseToApply->eclipseCaseData()->mainGrid();
|
||||
|
||||
RigEclipseCaseData* eclipseCaseData = caseToApply->eclipseCaseData();
|
||||
RigCaseCellResultsData* gridCellResults = caseToApply->results(RiaDefines::MATRIX_MODEL);
|
||||
RigEclipseCaseData* eclipseCaseData = caseToApply->eclipseCaseData();
|
||||
RigCaseCellResultsData* gridCellResults = caseToApply->results( RiaDefines::MATRIX_MODEL );
|
||||
|
||||
RigActiveCellInfo* actCellInfo = caseToApply->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL);
|
||||
size_t resultCellCount = actCellInfo->reservoirCellResultCount();
|
||||
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");
|
||||
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<double>* porvResults = nullptr;
|
||||
std::vector<double> porvActiveCellsResultStorage;
|
||||
porvResults = RigCaseCellResultsData::getResultIndexableStaticResult(actCellInfo, gridCellResults, "PORV", porvActiveCellsResultStorage);
|
||||
std::vector<double> porvActiveCellsResultStorage;
|
||||
porvResults = RigCaseCellResultsData::getResultIndexableStaticResult( actCellInfo,
|
||||
gridCellResults,
|
||||
"PORV",
|
||||
porvActiveCellsResultStorage );
|
||||
|
||||
progress.incrementProgress();
|
||||
|
||||
|
||||
// SWCR if defined
|
||||
|
||||
const std::vector<double>* swcrResults = nullptr;
|
||||
swcrResults = RigCaseCellResultsData::getResultIndexableStaticResult(actCellInfo, gridCellResults, "SWCR", porvActiveCellsResultStorage);
|
||||
swcrResults = RigCaseCellResultsData::getResultIndexableStaticResult( actCellInfo,
|
||||
gridCellResults,
|
||||
"SWCR",
|
||||
porvActiveCellsResultStorage );
|
||||
progress.incrementProgress();
|
||||
|
||||
std::vector<RigEclipseResultAddress> tracerResAddrs;
|
||||
for (QString tracerName : tracerNames)
|
||||
for ( QString tracerName : tracerNames )
|
||||
{
|
||||
RigEclipseResultAddress tracerResAddr(RiaDefines::DYNAMIC_NATIVE, tracerName);
|
||||
if (gridCellResults->ensureKnownResultLoaded(tracerResAddr) )
|
||||
RigEclipseResultAddress tracerResAddr( RiaDefines::DYNAMIC_NATIVE, tracerName );
|
||||
if ( gridCellResults->ensureKnownResultLoaded( tracerResAddr ) )
|
||||
{
|
||||
tracerResAddrs.push_back(tracerResAddr);
|
||||
tracerResAddrs.push_back( tracerResAddr );
|
||||
}
|
||||
progress.incrementProgress();
|
||||
}
|
||||
std::vector<std::vector<double> > summedTracersAtAllTimesteps;
|
||||
std::vector<std::vector<double>> summedTracersAtAllTimesteps;
|
||||
|
||||
//TODO: Option for Oil and Gas instead of water
|
||||
RigEclipseResultAddress flrWatIAddr(RiaDefines::DYNAMIC_NATIVE, "FLRWATI+");
|
||||
RigEclipseResultAddress flrWatJAddr(RiaDefines::DYNAMIC_NATIVE, "FLRWATJ+");
|
||||
RigEclipseResultAddress flrWatKAddr(RiaDefines::DYNAMIC_NATIVE, "FLRWATK+");
|
||||
// TODO: Option for Oil and Gas instead of water
|
||||
RigEclipseResultAddress flrWatIAddr( RiaDefines::DYNAMIC_NATIVE, "FLRWATI+" );
|
||||
RigEclipseResultAddress flrWatJAddr( RiaDefines::DYNAMIC_NATIVE, "FLRWATJ+" );
|
||||
RigEclipseResultAddress flrWatKAddr( RiaDefines::DYNAMIC_NATIVE, "FLRWATK+" );
|
||||
|
||||
bool hasFlowrateI = gridCellResults->ensureKnownResultLoaded(flrWatIAddr);
|
||||
bool hasFlowrateI = gridCellResults->ensureKnownResultLoaded( flrWatIAddr );
|
||||
progress.incrementProgress();
|
||||
bool hasFlowrateJ = gridCellResults->ensureKnownResultLoaded(flrWatJAddr);
|
||||
bool hasFlowrateJ = gridCellResults->ensureKnownResultLoaded( flrWatJAddr );
|
||||
progress.incrementProgress();
|
||||
bool hasFlowrateK = gridCellResults->ensureKnownResultLoaded(flrWatKAddr);
|
||||
bool hasFlowrateK = gridCellResults->ensureKnownResultLoaded( flrWatKAddr );
|
||||
progress.incrementProgress();
|
||||
|
||||
std::vector<const std::vector<double>* > flowrateIatAllTimeSteps;
|
||||
std::vector<const std::vector<double>* > flowrateJatAllTimeSteps;
|
||||
std::vector<const std::vector<double>* > flowrateKatAllTimeSteps;
|
||||
std::vector<const std::vector<double>*> flowrateIatAllTimeSteps;
|
||||
std::vector<const std::vector<double>*> flowrateJatAllTimeSteps;
|
||||
std::vector<const std::vector<double>*> flowrateKatAllTimeSteps;
|
||||
|
||||
RigNNCData* nncData = eclipseCaseData->mainGrid()->nncData();
|
||||
RigNNCData* nncData = eclipseCaseData->mainGrid()->nncData();
|
||||
const std::vector<RigConnection> connections = nncData->connections();
|
||||
|
||||
progress.incrementProgress();
|
||||
|
||||
//TODO: oil or gas flowrate
|
||||
std::vector<const std::vector<double>* > flowrateNNCatAllTimeSteps;
|
||||
QString nncConnectionProperty = mainGrid->nncData()->propertyNameFluxWat();
|
||||
|
||||
progress.incrementProgress();
|
||||
|
||||
std::vector<double> daysSinceSimulationStart = caseToApply->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->daysSinceSimulationStart();
|
||||
// TODO: oil or gas flowrate
|
||||
std::vector<const std::vector<double>*> flowrateNNCatAllTimeSteps;
|
||||
QString nncConnectionProperty = mainGrid->nncData()->propertyNameFluxWat();
|
||||
|
||||
progress.incrementProgress();
|
||||
|
||||
for (size_t timeStep = 0; timeStep < daysSinceSimulationStart.size(); timeStep++)
|
||||
std::vector<double> daysSinceSimulationStart =
|
||||
caseToApply->eclipseCaseData()->results( RiaDefines::MATRIX_MODEL )->daysSinceSimulationStart();
|
||||
|
||||
progress.incrementProgress();
|
||||
|
||||
for ( size_t timeStep = 0; timeStep < daysSinceSimulationStart.size(); timeStep++ )
|
||||
{
|
||||
const std::vector<double>* flowrateI = nullptr;
|
||||
if (hasFlowrateI)
|
||||
if ( hasFlowrateI )
|
||||
{
|
||||
flowrateI = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(flrWatIAddr,
|
||||
timeStep));
|
||||
flowrateI = &(
|
||||
eclipseCaseData->results( RiaDefines::MATRIX_MODEL )->cellScalarResults( flrWatIAddr, timeStep ) );
|
||||
}
|
||||
flowrateIatAllTimeSteps.push_back(flowrateI);
|
||||
|
||||
flowrateIatAllTimeSteps.push_back( flowrateI );
|
||||
|
||||
const std::vector<double>* flowrateJ = nullptr;
|
||||
if (hasFlowrateJ)
|
||||
if ( hasFlowrateJ )
|
||||
{
|
||||
flowrateJ = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(flrWatJAddr,
|
||||
timeStep));
|
||||
flowrateJ = &(
|
||||
eclipseCaseData->results( RiaDefines::MATRIX_MODEL )->cellScalarResults( flrWatJAddr, timeStep ) );
|
||||
}
|
||||
flowrateJatAllTimeSteps.push_back(flowrateJ);
|
||||
|
||||
flowrateJatAllTimeSteps.push_back( flowrateJ );
|
||||
|
||||
const std::vector<double>* flowrateK = nullptr;
|
||||
if (hasFlowrateK)
|
||||
if ( hasFlowrateK )
|
||||
{
|
||||
flowrateK = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(flrWatKAddr,
|
||||
timeStep));
|
||||
flowrateK = &(
|
||||
eclipseCaseData->results( RiaDefines::MATRIX_MODEL )->cellScalarResults( flrWatKAddr, timeStep ) );
|
||||
}
|
||||
flowrateKatAllTimeSteps.push_back(flowrateK);
|
||||
flowrateKatAllTimeSteps.push_back( flowrateK );
|
||||
|
||||
size_t nativeTimeStepIndex = caseToApply->uiToNativeTimeStepIndex(timeStep);
|
||||
const std::vector<double>* connectionFlowrate = nncData->dynamicConnectionScalarResultByName(nncConnectionProperty,
|
||||
nativeTimeStepIndex);
|
||||
flowrateNNCatAllTimeSteps.push_back(connectionFlowrate);
|
||||
size_t nativeTimeStepIndex = caseToApply->uiToNativeTimeStepIndex( timeStep );
|
||||
const std::vector<double>* connectionFlowrate = nncData->dynamicConnectionScalarResultByName( nncConnectionProperty,
|
||||
nativeTimeStepIndex );
|
||||
flowrateNNCatAllTimeSteps.push_back( connectionFlowrate );
|
||||
|
||||
|
||||
//sum all tracers at current timestep
|
||||
std::vector<double> summedTracerValues(resultCellCount);
|
||||
for (const RigEclipseResultAddress& tracerResAddr : tracerResAddrs)
|
||||
// sum all tracers at current timestep
|
||||
std::vector<double> summedTracerValues( resultCellCount );
|
||||
for ( const RigEclipseResultAddress& tracerResAddr : tracerResAddrs )
|
||||
{
|
||||
const std::vector<double>* tracerResult = &(eclipseCaseData->results(RiaDefines::MATRIX_MODEL)->cellScalarResults(tracerResAddr, timeStep));
|
||||
const std::vector<double>* tracerResult = &(
|
||||
eclipseCaseData->results( RiaDefines::MATRIX_MODEL )->cellScalarResults( tracerResAddr, timeStep ) );
|
||||
|
||||
for ( size_t i = 0; i < summedTracerValues.size(); i++ )
|
||||
{
|
||||
summedTracerValues[i] += tracerResult->at(i);
|
||||
summedTracerValues[i] += tracerResult->at( i );
|
||||
}
|
||||
}
|
||||
summedTracersAtAllTimesteps.push_back(summedTracerValues);
|
||||
summedTracersAtAllTimesteps.push_back( summedTracerValues );
|
||||
|
||||
progress.incrementProgress();
|
||||
}
|
||||
|
||||
progress.setNextProgressIncrement(2*timeStepCount);
|
||||
progress.setProgressDescription("Calculating");
|
||||
|
||||
calculate(mainGrid,
|
||||
caseToApply,
|
||||
daysSinceSimulationStart,
|
||||
porvResults,
|
||||
swcrResults,
|
||||
flowrateIatAllTimeSteps,
|
||||
flowrateJatAllTimeSteps,
|
||||
flowrateKatAllTimeSteps,
|
||||
connections,
|
||||
flowrateNNCatAllTimeSteps,
|
||||
summedTracersAtAllTimesteps);
|
||||
progress.setNextProgressIncrement( 2 * timeStepCount );
|
||||
progress.setProgressDescription( "Calculating" );
|
||||
|
||||
calculate( mainGrid,
|
||||
caseToApply,
|
||||
daysSinceSimulationStart,
|
||||
porvResults,
|
||||
swcrResults,
|
||||
flowrateIatAllTimeSteps,
|
||||
flowrateJatAllTimeSteps,
|
||||
flowrateKatAllTimeSteps,
|
||||
connections,
|
||||
flowrateNNCatAllTimeSteps,
|
||||
summedTracersAtAllTimesteps );
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<std::vector<double>>& RigNumberOfFloodedPoreVolumesCalculator::numberOfFloodedPorevolumes()
|
||||
{
|
||||
return m_cumWinflowPVAllTimeSteps;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigNumberOfFloodedPoreVolumesCalculator::calculate(RigMainGrid* mainGrid,
|
||||
RimEclipseCase* caseToApply,
|
||||
std::vector<double> daysSinceSimulationStart,
|
||||
const std::vector<double>* porvResultsActiveCellsOnly,
|
||||
const std::vector<double>* swcrResults,
|
||||
std::vector<const std::vector<double>* > flowrateIatAllTimeSteps,
|
||||
std::vector<const std::vector<double>* > flowrateJatAllTimeSteps,
|
||||
std::vector<const std::vector<double>* > flowrateKatAllTimeSteps,
|
||||
const std::vector<RigConnection> connections,
|
||||
std::vector<const std::vector<double>* > flowrateNNCatAllTimeSteps,
|
||||
std::vector<std::vector<double> > summedTracersAtAllTimesteps)
|
||||
void RigNumberOfFloodedPoreVolumesCalculator::calculate( RigMainGrid* mainGrid,
|
||||
RimEclipseCase* caseToApply,
|
||||
std::vector<double> daysSinceSimulationStart,
|
||||
const std::vector<double>* porvResultsActiveCellsOnly,
|
||||
const std::vector<double>* swcrResults,
|
||||
std::vector<const std::vector<double>*> flowrateIatAllTimeSteps,
|
||||
std::vector<const std::vector<double>*> flowrateJatAllTimeSteps,
|
||||
std::vector<const std::vector<double>*> flowrateKatAllTimeSteps,
|
||||
const std::vector<RigConnection> connections,
|
||||
std::vector<const std::vector<double>*> flowrateNNCatAllTimeSteps,
|
||||
std::vector<std::vector<double>> summedTracersAtAllTimesteps )
|
||||
{
|
||||
//size_t totalNumberOfCells = mainGrid->globalCellArray().size();
|
||||
RigActiveCellInfo* actCellInfo = caseToApply->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL);
|
||||
size_t resultCellCount = actCellInfo->reservoirCellResultCount();
|
||||
// size_t totalNumberOfCells = mainGrid->globalCellArray().size();
|
||||
RigActiveCellInfo* actCellInfo = caseToApply->eclipseCaseData()->activeCellInfo( RiaDefines::MATRIX_MODEL );
|
||||
size_t resultCellCount = actCellInfo->reservoirCellResultCount();
|
||||
|
||||
caf::ProgressInfo progress(2*daysSinceSimulationStart.size() , "");
|
||||
caf::ProgressInfo progress( 2 * daysSinceSimulationStart.size(), "" );
|
||||
|
||||
std::vector<std::vector<double>> cellQwInAtAllTimeSteps;
|
||||
std::vector<double> cellQwInTimeStep0(resultCellCount);
|
||||
cellQwInAtAllTimeSteps.push_back(cellQwInTimeStep0);
|
||||
std::vector<double> cellQwInTimeStep0( resultCellCount );
|
||||
cellQwInAtAllTimeSteps.push_back( cellQwInTimeStep0 );
|
||||
|
||||
for (size_t timeStep = 1; timeStep < daysSinceSimulationStart.size(); timeStep++)
|
||||
for ( size_t timeStep = 1; timeStep < daysSinceSimulationStart.size(); timeStep++ )
|
||||
{
|
||||
std::vector<double> totoalFlowrateIntoCell(resultCellCount); //brukt result celle index / active antall i stedet
|
||||
std::vector<double> totoalFlowrateIntoCell(
|
||||
resultCellCount ); // brukt result celle index / active antall i stedet
|
||||
|
||||
if ( flowrateIatAllTimeSteps[timeStep-1] != nullptr
|
||||
&& flowrateJatAllTimeSteps[timeStep-1] != nullptr
|
||||
&& flowrateKatAllTimeSteps[timeStep-1] != nullptr)
|
||||
if ( flowrateIatAllTimeSteps[timeStep - 1] != nullptr && flowrateJatAllTimeSteps[timeStep - 1] != nullptr &&
|
||||
flowrateKatAllTimeSteps[timeStep - 1] != nullptr )
|
||||
|
||||
{
|
||||
const std::vector<double>* flowrateI = flowrateIatAllTimeSteps[timeStep-1];
|
||||
const std::vector<double>* flowrateJ = flowrateJatAllTimeSteps[timeStep-1];
|
||||
const std::vector<double>* flowrateK = flowrateKatAllTimeSteps[timeStep-1];
|
||||
const std::vector<double>* flowrateI = flowrateIatAllTimeSteps[timeStep - 1];
|
||||
const std::vector<double>* flowrateJ = flowrateJatAllTimeSteps[timeStep - 1];
|
||||
const std::vector<double>* flowrateK = flowrateKatAllTimeSteps[timeStep - 1];
|
||||
|
||||
if (flowrateI->size() > 0 && flowrateJ->size() > 0 && flowrateK->size() > 0)
|
||||
if ( flowrateI->size() > 0 && flowrateJ->size() > 0 && flowrateK->size() > 0 )
|
||||
{
|
||||
distributeNeighbourCellFlow(mainGrid,
|
||||
caseToApply,
|
||||
summedTracersAtAllTimesteps[timeStep-1],
|
||||
flowrateI,
|
||||
flowrateJ,
|
||||
flowrateK,
|
||||
totoalFlowrateIntoCell);
|
||||
distributeNeighbourCellFlow( mainGrid,
|
||||
caseToApply,
|
||||
summedTracersAtAllTimesteps[timeStep - 1],
|
||||
flowrateI,
|
||||
flowrateJ,
|
||||
flowrateK,
|
||||
totoalFlowrateIntoCell );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const std::vector<double>* flowrateNNC = flowrateNNCatAllTimeSteps[timeStep-1];
|
||||
const std::vector<double>* flowrateNNC = flowrateNNCatAllTimeSteps[timeStep - 1];
|
||||
|
||||
if (flowrateNNC && flowrateNNC->size() > 0)
|
||||
if ( flowrateNNC && flowrateNNC->size() > 0 )
|
||||
{
|
||||
distributeNNCflow(connections,
|
||||
caseToApply,
|
||||
summedTracersAtAllTimesteps[timeStep-1],
|
||||
flowrateNNC,
|
||||
totoalFlowrateIntoCell);
|
||||
distributeNNCflow( connections,
|
||||
caseToApply,
|
||||
summedTracersAtAllTimesteps[timeStep - 1],
|
||||
flowrateNNC,
|
||||
totoalFlowrateIntoCell );
|
||||
}
|
||||
|
||||
std::vector<double> CellQwIn(resultCellCount);
|
||||
std::vector<double> CellQwIn( resultCellCount );
|
||||
|
||||
double daysSinceSimStartNow = daysSinceSimulationStart[timeStep];
|
||||
double daysSinceSimStartNow = daysSinceSimulationStart[timeStep];
|
||||
double daysSinceSimStartLastTimeStep = daysSinceSimulationStart[timeStep - 1];
|
||||
double deltaT = daysSinceSimStartNow - daysSinceSimStartLastTimeStep;
|
||||
double deltaT = daysSinceSimStartNow - daysSinceSimStartLastTimeStep;
|
||||
|
||||
for (size_t cellResultIndex = 0; cellResultIndex < resultCellCount; cellResultIndex++)
|
||||
for ( size_t cellResultIndex = 0; cellResultIndex < resultCellCount; cellResultIndex++ )
|
||||
{
|
||||
CellQwIn[cellResultIndex] = cellQwInAtAllTimeSteps[timeStep - 1][cellResultIndex]
|
||||
+ (totoalFlowrateIntoCell[cellResultIndex]) * deltaT;
|
||||
CellQwIn[cellResultIndex] = cellQwInAtAllTimeSteps[timeStep - 1][cellResultIndex] +
|
||||
( totoalFlowrateIntoCell[cellResultIndex] ) * deltaT;
|
||||
}
|
||||
cellQwInAtAllTimeSteps.push_back(CellQwIn);
|
||||
cellQwInAtAllTimeSteps.push_back( CellQwIn );
|
||||
|
||||
progress.incrementProgress();
|
||||
}
|
||||
|
||||
|
||||
//Calculate number-of-cell-PV flooded
|
||||
// Calculate number-of-cell-PV flooded
|
||||
|
||||
std::vector<double> cumWinflowPVTimeStep0(resultCellCount);
|
||||
std::vector<double> cumWinflowPVTimeStep0( resultCellCount );
|
||||
m_cumWinflowPVAllTimeSteps.clear();
|
||||
m_cumWinflowPVAllTimeSteps.push_back(cumWinflowPVTimeStep0);
|
||||
m_cumWinflowPVAllTimeSteps.push_back( cumWinflowPVTimeStep0 );
|
||||
|
||||
for (size_t timeStep = 1; timeStep < daysSinceSimulationStart.size(); timeStep++)
|
||||
for ( size_t timeStep = 1; timeStep < daysSinceSimulationStart.size(); timeStep++ )
|
||||
{
|
||||
std::vector<double> cumWinflowPV(resultCellCount);
|
||||
for (size_t cellResultIndex = 0; cellResultIndex < resultCellCount; cellResultIndex++)
|
||||
std::vector<double> cumWinflowPV( resultCellCount );
|
||||
for ( size_t cellResultIndex = 0; cellResultIndex < resultCellCount; cellResultIndex++ )
|
||||
{
|
||||
double scaledPoreVolume = porvResultsActiveCellsOnly->at(cellResultIndex);
|
||||
if (swcrResults != nullptr && swcrResults->size() == resultCellCount)
|
||||
double scaledPoreVolume = porvResultsActiveCellsOnly->at( cellResultIndex );
|
||||
if ( swcrResults != nullptr && swcrResults->size() == resultCellCount )
|
||||
{
|
||||
scaledPoreVolume = scaledPoreVolume * (1 - swcrResults->at(cellResultIndex));
|
||||
scaledPoreVolume = scaledPoreVolume * ( 1 - swcrResults->at( cellResultIndex ) );
|
||||
}
|
||||
|
||||
cumWinflowPV[cellResultIndex] = cellQwInAtAllTimeSteps[timeStep][cellResultIndex]
|
||||
/ scaledPoreVolume;
|
||||
cumWinflowPV[cellResultIndex] = cellQwInAtAllTimeSteps[timeStep][cellResultIndex] / scaledPoreVolume;
|
||||
}
|
||||
m_cumWinflowPVAllTimeSteps.push_back(cumWinflowPV);
|
||||
m_cumWinflowPVAllTimeSteps.push_back( cumWinflowPV );
|
||||
progress.incrementProgress();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigNumberOfFloodedPoreVolumesCalculator::distributeNNCflow(std::vector<RigConnection> connections,
|
||||
RimEclipseCase* caseToApply,
|
||||
std::vector<double> summedTracerValues,
|
||||
const std::vector<double>* flowrateNNC,
|
||||
std::vector<double> &flowrateIntoCell)
|
||||
void RigNumberOfFloodedPoreVolumesCalculator::distributeNNCflow( std::vector<RigConnection> connections,
|
||||
RimEclipseCase* caseToApply,
|
||||
std::vector<double> summedTracerValues,
|
||||
const std::vector<double>* flowrateNNC,
|
||||
std::vector<double>& flowrateIntoCell )
|
||||
{
|
||||
RigActiveCellInfo* actCellInfo = caseToApply->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL);
|
||||
RigActiveCellInfo* actCellInfo = caseToApply->eclipseCaseData()->activeCellInfo( RiaDefines::MATRIX_MODEL );
|
||||
|
||||
|
||||
for (size_t connectionIndex = 0; connectionIndex < connections.size(); connectionIndex++)
|
||||
for ( size_t connectionIndex = 0; connectionIndex < connections.size(); connectionIndex++ )
|
||||
{
|
||||
RigConnection connection = connections[connectionIndex];
|
||||
double connectionValue = flowrateNNC->at(connectionIndex);
|
||||
RigConnection connection = connections[connectionIndex];
|
||||
double connectionValue = flowrateNNC->at( connectionIndex );
|
||||
|
||||
size_t cell1Index = connection.m_c1GlobIdx;
|
||||
size_t cell1ResultIndex = actCellInfo->cellResultIndex(cell1Index);
|
||||
size_t cell1Index = connection.m_c1GlobIdx;
|
||||
size_t cell1ResultIndex = actCellInfo->cellResultIndex( cell1Index );
|
||||
|
||||
size_t cell2Index = connection.m_c2GlobIdx;
|
||||
size_t cell2ResultIndex = actCellInfo->cellResultIndex(cell2Index);
|
||||
size_t cell2Index = connection.m_c2GlobIdx;
|
||||
size_t cell2ResultIndex = actCellInfo->cellResultIndex( cell2Index );
|
||||
|
||||
if (connectionValue > 0)
|
||||
if ( connectionValue > 0 )
|
||||
{
|
||||
//Flow out of cell with cell1index, into cell cell2index
|
||||
// Flow out of cell with cell1index, into cell cell2index
|
||||
flowrateIntoCell[cell2ResultIndex] += connectionValue * summedTracerValues[cell1ResultIndex];
|
||||
}
|
||||
else if (connectionValue < 0)
|
||||
else if ( connectionValue < 0 )
|
||||
{
|
||||
//flow out of cell with cell2index, into cell cell1index
|
||||
flowrateIntoCell[cell1ResultIndex] += -1.0*connectionValue * summedTracerValues[cell2ResultIndex];
|
||||
// flow out of cell with cell2index, into cell cell1index
|
||||
flowrateIntoCell[cell1ResultIndex] += -1.0 * connectionValue * summedTracerValues[cell2ResultIndex];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigNumberOfFloodedPoreVolumesCalculator::distributeNeighbourCellFlow(RigMainGrid* mainGrid,
|
||||
RimEclipseCase* caseToApply,
|
||||
std::vector<double> summedTracerValues,
|
||||
const std::vector<double>* flrWatResultI,
|
||||
const std::vector<double>* flrWatResultJ,
|
||||
const std::vector<double>* flrWatResultK,
|
||||
std::vector<double> &totalFlowrateIntoCell)
|
||||
void RigNumberOfFloodedPoreVolumesCalculator::distributeNeighbourCellFlow( RigMainGrid* mainGrid,
|
||||
RimEclipseCase* caseToApply,
|
||||
std::vector<double> summedTracerValues,
|
||||
const std::vector<double>* flrWatResultI,
|
||||
const std::vector<double>* flrWatResultJ,
|
||||
const std::vector<double>* flrWatResultK,
|
||||
std::vector<double>& totalFlowrateIntoCell )
|
||||
{
|
||||
RigActiveCellInfo* actCellInfo = caseToApply->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL);
|
||||
RigActiveCellInfo* actCellInfo = caseToApply->eclipseCaseData()->activeCellInfo( RiaDefines::MATRIX_MODEL );
|
||||
|
||||
for (size_t globalCellIndex = 0; globalCellIndex < mainGrid->globalCellArray().size(); globalCellIndex++)
|
||||
for ( size_t globalCellIndex = 0; globalCellIndex < mainGrid->globalCellArray().size(); globalCellIndex++ )
|
||||
{
|
||||
if (!actCellInfo->isActive(globalCellIndex)) continue;
|
||||
if ( !actCellInfo->isActive( globalCellIndex ) ) continue;
|
||||
|
||||
const RigCell& cell = mainGrid->globalCellArray()[globalCellIndex];
|
||||
RigGridBase* hostGrid = cell.hostGrid();
|
||||
size_t gridLocalCellIndex = cell.gridLocalCellIndex();
|
||||
|
||||
size_t cellResultIndex = actCellInfo->cellResultIndex(globalCellIndex);
|
||||
const RigCell& cell = mainGrid->globalCellArray()[globalCellIndex];
|
||||
RigGridBase* hostGrid = cell.hostGrid();
|
||||
size_t gridLocalCellIndex = cell.gridLocalCellIndex();
|
||||
|
||||
size_t cellResultIndex = actCellInfo->cellResultIndex( globalCellIndex );
|
||||
|
||||
size_t i, j, k;
|
||||
hostGrid->ijkFromCellIndex(gridLocalCellIndex, &i, &j, &k);
|
||||
hostGrid->ijkFromCellIndex( gridLocalCellIndex, &i, &j, &k );
|
||||
|
||||
if (i < (hostGrid->cellCountI()-1))
|
||||
if ( i < ( hostGrid->cellCountI() - 1 ) )
|
||||
{
|
||||
size_t gridLocalCellIndexPosINeighbour = hostGrid->cellIndexFromIJK(i + 1, j, k);
|
||||
size_t reservoirCellIndexPosINeighbour = hostGrid->reservoirCellIndex(gridLocalCellIndexPosINeighbour);
|
||||
size_t cellResultIndexPosINeighbour = actCellInfo->cellResultIndex(reservoirCellIndexPosINeighbour);
|
||||
|
||||
if (!actCellInfo->isActive(reservoirCellIndexPosINeighbour)) continue;
|
||||
|
||||
if (hostGrid->cell(gridLocalCellIndexPosINeighbour).subGrid() != nullptr)
|
||||
size_t gridLocalCellIndexPosINeighbour = hostGrid->cellIndexFromIJK( i + 1, j, k );
|
||||
size_t reservoirCellIndexPosINeighbour = hostGrid->reservoirCellIndex( gridLocalCellIndexPosINeighbour );
|
||||
size_t cellResultIndexPosINeighbour = actCellInfo->cellResultIndex( reservoirCellIndexPosINeighbour );
|
||||
|
||||
if ( !actCellInfo->isActive( reservoirCellIndexPosINeighbour ) ) continue;
|
||||
|
||||
if ( hostGrid->cell( gridLocalCellIndexPosINeighbour ).subGrid() != nullptr )
|
||||
{
|
||||
//subgrid exists in cell, will be handled though NNCs
|
||||
// subgrid exists in cell, will be handled though NNCs
|
||||
continue;
|
||||
}
|
||||
|
||||
if (flrWatResultI->at(cellResultIndex) > 0)
|
||||
|
||||
if ( flrWatResultI->at( cellResultIndex ) > 0 )
|
||||
{
|
||||
//Flow out of cell globalCellIndex, into cell i+1
|
||||
totalFlowrateIntoCell[cellResultIndexPosINeighbour] += flrWatResultI->at(cellResultIndex) * summedTracerValues[cellResultIndex];
|
||||
// Flow out of cell globalCellIndex, into cell i+1
|
||||
totalFlowrateIntoCell[cellResultIndexPosINeighbour] += flrWatResultI->at( cellResultIndex ) *
|
||||
summedTracerValues[cellResultIndex];
|
||||
}
|
||||
else if (flrWatResultI->at(cellResultIndex) < 0)
|
||||
else if ( flrWatResultI->at( cellResultIndex ) < 0 )
|
||||
{
|
||||
//Flow into cell globelCellIndex, from cell i+1
|
||||
totalFlowrateIntoCell[cellResultIndex] += (-1.0) * flrWatResultI->at(cellResultIndex) * summedTracerValues[cellResultIndexPosINeighbour];
|
||||
// Flow into cell globelCellIndex, from cell i+1
|
||||
totalFlowrateIntoCell[cellResultIndex] += ( -1.0 ) * flrWatResultI->at( cellResultIndex ) *
|
||||
summedTracerValues[cellResultIndexPosINeighbour];
|
||||
}
|
||||
}
|
||||
|
||||
if (j < (hostGrid->cellCountJ()-1))
|
||||
if ( j < ( hostGrid->cellCountJ() - 1 ) )
|
||||
{
|
||||
size_t gridLocalCellIndexPosJNeighbour = hostGrid->cellIndexFromIJK(i, j + 1, k);
|
||||
size_t reservoirCellIndexPosJNeighbour = hostGrid->reservoirCellIndex(gridLocalCellIndexPosJNeighbour);
|
||||
size_t cellResultIndexPosJNeighbour = actCellInfo->cellResultIndex(reservoirCellIndexPosJNeighbour);
|
||||
size_t gridLocalCellIndexPosJNeighbour = hostGrid->cellIndexFromIJK( i, j + 1, k );
|
||||
size_t reservoirCellIndexPosJNeighbour = hostGrid->reservoirCellIndex( gridLocalCellIndexPosJNeighbour );
|
||||
size_t cellResultIndexPosJNeighbour = actCellInfo->cellResultIndex( reservoirCellIndexPosJNeighbour );
|
||||
|
||||
if (!actCellInfo->isActive(reservoirCellIndexPosJNeighbour)) continue;
|
||||
|
||||
if (hostGrid->cell(gridLocalCellIndexPosJNeighbour).subGrid() != nullptr)
|
||||
if ( !actCellInfo->isActive( reservoirCellIndexPosJNeighbour ) ) continue;
|
||||
|
||||
if ( hostGrid->cell( gridLocalCellIndexPosJNeighbour ).subGrid() != nullptr )
|
||||
{
|
||||
//subgrid exists in cell, will be handled though NNCs
|
||||
// subgrid exists in cell, will be handled though NNCs
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (flrWatResultJ->at(cellResultIndex) > 0)
|
||||
if ( flrWatResultJ->at( cellResultIndex ) > 0 )
|
||||
{
|
||||
//Flow out of cell globalCellIndex, into cell i+1
|
||||
totalFlowrateIntoCell[cellResultIndexPosJNeighbour] += flrWatResultJ->at(cellResultIndex) * summedTracerValues[cellResultIndex];
|
||||
// Flow out of cell globalCellIndex, into cell i+1
|
||||
totalFlowrateIntoCell[cellResultIndexPosJNeighbour] += flrWatResultJ->at( cellResultIndex ) *
|
||||
summedTracerValues[cellResultIndex];
|
||||
}
|
||||
else if (flrWatResultJ->at(cellResultIndex) < 0)
|
||||
else if ( flrWatResultJ->at( cellResultIndex ) < 0 )
|
||||
{
|
||||
//Flow into cell globelCellIndex, from cell i+1
|
||||
totalFlowrateIntoCell[cellResultIndex] += (-1.0) * flrWatResultJ->at(cellResultIndex) * summedTracerValues[cellResultIndexPosJNeighbour];
|
||||
// Flow into cell globelCellIndex, from cell i+1
|
||||
totalFlowrateIntoCell[cellResultIndex] += ( -1.0 ) * flrWatResultJ->at( cellResultIndex ) *
|
||||
summedTracerValues[cellResultIndexPosJNeighbour];
|
||||
}
|
||||
}
|
||||
|
||||
if (k < (hostGrid->cellCountK()-1))
|
||||
if ( k < ( hostGrid->cellCountK() - 1 ) )
|
||||
{
|
||||
size_t gridLocalCellIndexPosKNeighbour = hostGrid->cellIndexFromIJK(i, j, k + 1);
|
||||
size_t reservoirCellIndexPosKNeighbour = hostGrid->reservoirCellIndex(gridLocalCellIndexPosKNeighbour);
|
||||
size_t cellResultIndexPosKNeighbour = actCellInfo->cellResultIndex(reservoirCellIndexPosKNeighbour);
|
||||
size_t gridLocalCellIndexPosKNeighbour = hostGrid->cellIndexFromIJK( i, j, k + 1 );
|
||||
size_t reservoirCellIndexPosKNeighbour = hostGrid->reservoirCellIndex( gridLocalCellIndexPosKNeighbour );
|
||||
size_t cellResultIndexPosKNeighbour = actCellInfo->cellResultIndex( reservoirCellIndexPosKNeighbour );
|
||||
|
||||
if (!actCellInfo->isActive(reservoirCellIndexPosKNeighbour)) continue;
|
||||
if ( !actCellInfo->isActive( reservoirCellIndexPosKNeighbour ) ) continue;
|
||||
|
||||
if (hostGrid->cell(gridLocalCellIndexPosKNeighbour).subGrid() != nullptr)
|
||||
if ( hostGrid->cell( gridLocalCellIndexPosKNeighbour ).subGrid() != nullptr )
|
||||
{
|
||||
//subgrid exists in cell, will be handled though NNCs
|
||||
// subgrid exists in cell, will be handled though NNCs
|
||||
continue;
|
||||
}
|
||||
|
||||
if (flrWatResultK->at(cellResultIndex) > 0)
|
||||
if ( flrWatResultK->at( cellResultIndex ) > 0 )
|
||||
{
|
||||
//Flow out of cell globalCellIndex, into cell i+1
|
||||
totalFlowrateIntoCell[cellResultIndexPosKNeighbour] += flrWatResultK->at(cellResultIndex) * summedTracerValues[cellResultIndex];
|
||||
// Flow out of cell globalCellIndex, into cell i+1
|
||||
totalFlowrateIntoCell[cellResultIndexPosKNeighbour] += flrWatResultK->at( cellResultIndex ) *
|
||||
summedTracerValues[cellResultIndex];
|
||||
}
|
||||
else if (flrWatResultK->at(cellResultIndex) < 0)
|
||||
else if ( flrWatResultK->at( cellResultIndex ) < 0 )
|
||||
{
|
||||
//Flow into cell globelCellIndex, from cell i+1
|
||||
totalFlowrateIntoCell[cellResultIndex] += (-1.0) * flrWatResultK->at(cellResultIndex) * summedTracerValues[cellResultIndexPosKNeighbour];
|
||||
// Flow into cell globelCellIndex, from cell i+1
|
||||
totalFlowrateIntoCell[cellResultIndex] += ( -1.0 ) * flrWatResultK->at( cellResultIndex ) *
|
||||
summedTracerValues[cellResultIndexPosKNeighbour];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user