mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Added framework for statistical calculation reader
p4#: 20591
This commit is contained in:
@@ -0,0 +1,121 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "cvfBase.h"
|
||||
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigEclipseCase.h"
|
||||
#include "RigReservoirCellResults.h"
|
||||
|
||||
#include "RifReaderStatisticalCalculation.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Constructor
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifReaderStatisticalCalculation::RifReaderStatisticalCalculation()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Destructor
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifReaderStatisticalCalculation::~RifReaderStatisticalCalculation()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Open file and read geometry into given reservoir object
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifReaderStatisticalCalculation::open(const QString& fileName, RigEclipseCase* eclipseCase)
|
||||
{
|
||||
m_matrixDynamicResultNames.push_back("SOIL");
|
||||
m_matrixDynamicResultNames.push_back("PRESSURE");
|
||||
|
||||
buildMetaData(eclipseCase);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifReaderStatisticalCalculation::buildMetaData(RigEclipseCase* eclipseCase)
|
||||
{
|
||||
RigReservoirCellResults* matrixModelResults = eclipseCase->results(RifReaderInterface::MATRIX_RESULTS);
|
||||
RigReservoirCellResults* fractureModelResults = eclipseCase->results(RifReaderInterface::FRACTURE_RESULTS);
|
||||
|
||||
// Dynamic results
|
||||
for (int i = 0; i < m_matrixDynamicResultNames.size(); ++i)
|
||||
{
|
||||
size_t resIndex = matrixModelResults->addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, m_matrixDynamicResultNames[i]);
|
||||
matrixModelResults->setTimeStepDates(resIndex, m_timeSteps);
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_fractureDynamicResultNames.size(); ++i)
|
||||
{
|
||||
size_t resIndex = fractureModelResults->addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, m_fractureDynamicResultNames[i]);
|
||||
fractureModelResults->setTimeStepDates(resIndex, m_timeSteps);
|
||||
}
|
||||
|
||||
QList<QDateTime> staticDate;
|
||||
if (m_timeSteps.size() > 0)
|
||||
{
|
||||
staticDate.push_back(m_timeSteps.front());
|
||||
}
|
||||
|
||||
// Static results
|
||||
for (int i = 0; i < m_fractureStaticResultNames.size(); ++i)
|
||||
{
|
||||
size_t resIndex = fractureModelResults->addEmptyScalarResult(RimDefines::STATIC_NATIVE, m_fractureStaticResultNames[i]);
|
||||
fractureModelResults->setTimeStepDates(resIndex, staticDate);
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_matrixStaticResultNames.size(); ++i)
|
||||
{
|
||||
size_t resIndex = matrixModelResults->addEmptyScalarResult(RimDefines::STATIC_NATIVE, m_matrixStaticResultNames[i]);
|
||||
matrixModelResults->setTimeStepDates(resIndex, staticDate);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifReaderStatisticalCalculation::setMatrixResultNames(const QStringList& staticResultNames, const QStringList& dynamicResultNames)
|
||||
{
|
||||
m_matrixStaticResultNames = staticResultNames;
|
||||
m_matrixDynamicResultNames = dynamicResultNames;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifReaderStatisticalCalculation::setFractureResultNames(const QStringList& staticResultNames, const QStringList& dynamicResultNames)
|
||||
{
|
||||
m_fractureStaticResultNames = staticResultNames;
|
||||
m_fractureDynamicResultNames = dynamicResultNames;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifReaderStatisticalCalculation::setTimeSteps(const QList<QDateTime>& timesteps)
|
||||
{
|
||||
m_timeSteps = timesteps;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RifReaderInterface.h"
|
||||
|
||||
|
||||
class RifReaderStatisticalCalculation : public RifReaderInterface
|
||||
{
|
||||
public:
|
||||
RifReaderStatisticalCalculation();
|
||||
virtual ~RifReaderStatisticalCalculation();
|
||||
|
||||
// Virtual interface implementation
|
||||
virtual bool open(const QString& fileName, RigEclipseCase* eclipseCase);
|
||||
|
||||
virtual void close() {}
|
||||
|
||||
virtual bool staticResult(const QString& result, PorosityModelResultType matrixOrFracture, std::vector<double>* values ) { return false; }
|
||||
virtual bool dynamicResult(const QString& result, PorosityModelResultType matrixOrFracture, size_t stepIndex, std::vector<double>* values ) { return false; }
|
||||
|
||||
void setMatrixResultNames(const QStringList& staticResultNames, const QStringList& dynamicResultNames);
|
||||
void setFractureResultNames(const QStringList& staticResultNames, const QStringList& dynamicResultNames);
|
||||
|
||||
void setTimeSteps(const QList<QDateTime>& timesteps);
|
||||
|
||||
private:
|
||||
void buildMetaData(RigEclipseCase* eclipseCase);
|
||||
|
||||
private:
|
||||
QList<QDateTime> m_timeSteps;
|
||||
|
||||
QStringList m_matrixDynamicResultNames;
|
||||
QStringList m_fractureDynamicResultNames;
|
||||
|
||||
QStringList m_matrixStaticResultNames;
|
||||
QStringList m_fractureStaticResultNames;
|
||||
|
||||
};
|
||||
@@ -22,6 +22,9 @@
|
||||
#include "RimReservoirView.h"
|
||||
#include "cafPdmUiOrdering.h"
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
#include "RigEclipseCase.h"
|
||||
#include "RifReaderStatisticalCalculation.h"
|
||||
#include "RigReservoirCellResults.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimStatisticalCalculation, "RimStatisticalCalculation");
|
||||
@@ -37,6 +40,7 @@ RimStatisticalCalculation::RimStatisticalCalculation()
|
||||
CAF_PDM_InitField(&statisticsMean, "StatisticsMean", true, "Mean", "", "" ,"");
|
||||
CAF_PDM_InitField(&statisticsStdDev, "StatisticsStdDev", true, "Std dev", "", "" ,"");
|
||||
|
||||
m_readerInterface = new RifReaderStatisticalCalculation;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -52,6 +56,18 @@ RimStatisticalCalculation::~RimStatisticalCalculation()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimStatisticalCalculation::openEclipseGridFile()
|
||||
{
|
||||
cvf::ref<RigEclipseCase> eclipseCase = new RigEclipseCase;
|
||||
|
||||
if (!m_readerInterface->open("dummy", eclipseCase.p()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_rigEclipseCase = eclipseCase;
|
||||
|
||||
m_rigEclipseCase->results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(m_readerInterface.p());
|
||||
m_rigEclipseCase->results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(m_readerInterface.p());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
class RimIdenticalGridCaseGroup;
|
||||
class RimResultDefinition;
|
||||
class RifReaderStatisticalCalculation;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
@@ -60,4 +61,7 @@ private:
|
||||
void createAndComputeMean();
|
||||
void createAndComputeStdDev();
|
||||
|
||||
private:
|
||||
cvf::ref<RifReaderStatisticalCalculation> m_readerInterface;
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user