#1035 Work in progress: Added the skeleton for management FlowDiagnostics data

This commit is contained in:
Jacob Støren
2016-12-16 14:17:56 +01:00
parent e990de8243
commit 342855df56
15 changed files with 499 additions and 28 deletions

View File

@@ -38,6 +38,8 @@
#include "cafPdmUiListEditor.h" #include "cafPdmUiListEditor.h"
#include "RimEclipseResultCase.h" #include "RimEclipseResultCase.h"
#include "RigFlowDiagResultAddress.h"
CAF_PDM_SOURCE_INIT(RimEclipseResultDefinition, "ResultDefinition"); CAF_PDM_SOURCE_INIT(RimEclipseResultDefinition, "ResultDefinition");
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -285,10 +287,10 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
{ {
if ( fieldNeedingOptions == &m_resultVariableUiField ) if ( fieldNeedingOptions == &m_resultVariableUiField )
{ {
optionItems.push_back(caf::PdmOptionItemInfo("Time Of Flight (Weighted Sum)", "TOF")); optionItems.push_back(caf::PdmOptionItemInfo("Time Of Flight (Weighted Sum)", RIG_FLD_TOF_RESNAME));
optionItems.push_back(caf::PdmOptionItemInfo("Tracer Concentration (Sum)", "Concentrations")); optionItems.push_back(caf::PdmOptionItemInfo("Tracer Cell Fraction (Sum)", RIG_FLD_CELL_FRACTION_RESNAME));
optionItems.push_back(caf::PdmOptionItemInfo("Tracer with Max Concentration", "MaxTracer")); optionItems.push_back(caf::PdmOptionItemInfo("Max Fraction Tracer", RIG_FLD_MAX_FRACTION_TRACER_RESNAME));
optionItems.push_back(caf::PdmOptionItemInfo("Injector Producer Communication", "Communication")); optionItems.push_back(caf::PdmOptionItemInfo("Injector Producer Communication", RIG_FLD_COMMUNICATION_RESNAME));
} }
else if (fieldNeedingOptions == &m_flowSolutionUiField) else if (fieldNeedingOptions == &m_flowSolutionUiField)
{ {
@@ -446,13 +448,11 @@ QStringList RimEclipseResultDefinition::getResultNamesForCurrentUiResultType()
} }
else else
{ {
// TODO: Get this form some sensible place
QStringList flowVars; QStringList flowVars;
flowVars.push_back("TOF"); flowVars.push_back(RIG_FLD_TOF_RESNAME);
flowVars.push_back("Concentrations"); flowVars.push_back(RIG_FLD_CELL_FRACTION_RESNAME);
flowVars.push_back("MaxTracer"); flowVars.push_back(RIG_FLD_MAX_FRACTION_TRACER_RESNAME);
flowVars.push_back("Communication"); flowVars.push_back(RIG_FLD_COMMUNICATION_RESNAME);
return flowVars; return flowVars;
} }
} }
@@ -473,6 +473,20 @@ size_t RimEclipseResultDefinition::scalarResultIndex() const
return gridScalarResultIndex; return gridScalarResultIndex;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const
{
std::set<std::string> selTracerNames;
for (const QString& tName : m_selectedTracers())
{
selTracerNames.insert(tName.toStdString());
}
return RigFlowDiagResultAddress(m_resultVariable().toStdString(), selTracerNames);
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -590,6 +604,14 @@ void RimEclipseResultDefinition::setResultVariable(const QString& val)
m_resultVariableUiField = val; m_resultVariableUiField = val;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFlowDiagSolution* RimEclipseResultDefinition::flowDiagSolution()
{
return m_flowSolution();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -27,6 +27,7 @@
#include "cafPdmObject.h" #include "cafPdmObject.h"
#include "cafPdmPointer.h" #include "cafPdmPointer.h"
#include "cafPdmPtrField.h" #include "cafPdmPtrField.h"
#include "RigFlowDiagResultAddress.h"
class RigCaseCellResultsData; class RigCaseCellResultsData;
class RimEclipseCase; class RimEclipseCase;
@@ -53,6 +54,8 @@ public:
void setPorosityModel(RimDefines::PorosityModelType val); void setPorosityModel(RimDefines::PorosityModelType val);
QString resultVariable() const { return m_resultVariable(); } QString resultVariable() const { return m_resultVariable(); }
virtual void setResultVariable(const QString& val); virtual void setResultVariable(const QString& val);
RimFlowDiagSolution* flowDiagSolution();
RigFlowDiagResultAddress flowDiagResAddress() const;
void loadResult(); void loadResult();
size_t scalarResultIndex() const; size_t scalarResultIndex() const;

View File

@@ -20,6 +20,8 @@
#include "RimEclipseResultCase.h" #include "RimEclipseResultCase.h"
#include "RigCaseData.h" #include "RigCaseData.h"
#include "RigFlowDiagResults.h"
CAF_PDM_SOURCE_INIT(RimFlowDiagSolution, "FlowDiagSolution"); CAF_PDM_SOURCE_INIT(RimFlowDiagSolution, "FlowDiagSolution");
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -32,6 +34,9 @@ RimFlowDiagSolution::RimFlowDiagSolution(void)
//CAF_PDM_InitFieldNoDefault(&m_selectedWells, "SelectedWells", "Selected Wells","",""); //CAF_PDM_InitFieldNoDefault(&m_selectedWells, "SelectedWells", "Selected Wells","","");
CAF_PDM_InitField(&m_userDescription, "UserDescription", QString("All Wells") ,"Description", "", "",""); CAF_PDM_InitField(&m_userDescription, "UserDescription", QString("All Wells") ,"Description", "", "","");
m_flowDiagResults = new RigFlowDiagResults(this);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -42,6 +47,14 @@ RimFlowDiagSolution::~RimFlowDiagSolution(void)
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFlowDiagResults* RimFlowDiagSolution::flowDiagResults()
{
return m_flowDiagResults.p();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -24,7 +24,7 @@
#include "cafAppEnum.h" #include "cafAppEnum.h"
class RimEclipseWell; class RimEclipseWell;
class RigFlowDiagResults;
//================================================================================================== //==================================================================================================
/// ///
/// ///
@@ -33,11 +33,11 @@ class RimFlowDiagSolution : public caf::PdmObject
{ {
CAF_PDM_HEADER_INIT; CAF_PDM_HEADER_INIT;
public: public:
RimFlowDiagSolution(void); RimFlowDiagSolution();
virtual ~RimFlowDiagSolution(void); virtual ~RimFlowDiagSolution();
QString userDescription() { return m_userDescription();} QString userDescription() { return m_userDescription();}
RigFlowDiagResults* flowDiagResults();
std::set<QString> tracerNames(); std::set<QString> tracerNames();
enum TracerStatusType enum TracerStatusType
@@ -57,5 +57,7 @@ private:
virtual caf::PdmFieldHandle* userDescriptionField() override; virtual caf::PdmFieldHandle* userDescriptionField() override;
caf::PdmField<QString> m_userDescription; caf::PdmField<QString> m_userDescription;
cvf::ref<RigFlowDiagResults> m_flowDiagResults;
//caf::PdmPtrArrayField<RimEclipseWell*> m_selectedWells; //caf::PdmPtrArrayField<RimEclipseWell*> m_selectedWells;
}; };

View File

@@ -20,6 +20,10 @@ ${CEE_CURRENT_LIST_DIR}RigCombMultResultAccessor.h
${CEE_CURRENT_LIST_DIR}RigResultModifier.h ${CEE_CURRENT_LIST_DIR}RigResultModifier.h
${CEE_CURRENT_LIST_DIR}RigResultModifierFactory.h ${CEE_CURRENT_LIST_DIR}RigResultModifierFactory.h
${CEE_CURRENT_LIST_DIR}RigFormationNames.h ${CEE_CURRENT_LIST_DIR}RigFormationNames.h
${CEE_CURRENT_LIST_DIR}RigFlowDiagResultAddress.h
${CEE_CURRENT_LIST_DIR}RigFlowDiagResults.h
${CEE_CURRENT_LIST_DIR}RigFlowDiagResultFrames.h
${CEE_CURRENT_LIST_DIR}RigFlowDiagSolverInterface.h
${CEE_CURRENT_LIST_DIR}RigWellLogExtractor.h ${CEE_CURRENT_LIST_DIR}RigWellLogExtractor.h
${CEE_CURRENT_LIST_DIR}RigEclipseWellLogExtractor.h ${CEE_CURRENT_LIST_DIR}RigEclipseWellLogExtractor.h
${CEE_CURRENT_LIST_DIR}RigLocalGrid.h ${CEE_CURRENT_LIST_DIR}RigLocalGrid.h
@@ -59,6 +63,9 @@ ${CEE_CURRENT_LIST_DIR}RigCombTransResultAccessor.cpp
${CEE_CURRENT_LIST_DIR}RigCombMultResultAccessor.cpp ${CEE_CURRENT_LIST_DIR}RigCombMultResultAccessor.cpp
${CEE_CURRENT_LIST_DIR}RigResultModifierFactory.cpp ${CEE_CURRENT_LIST_DIR}RigResultModifierFactory.cpp
${CEE_CURRENT_LIST_DIR}RigFormationNames.cpp ${CEE_CURRENT_LIST_DIR}RigFormationNames.cpp
${CEE_CURRENT_LIST_DIR}RigFlowDiagResults.cpp
${CEE_CURRENT_LIST_DIR}RigFlowDiagResultFrames.cpp
${CEE_CURRENT_LIST_DIR}RigFlowDiagSolverInterface.cpp
${CEE_CURRENT_LIST_DIR}RigWellLogExtractor.cpp ${CEE_CURRENT_LIST_DIR}RigWellLogExtractor.cpp
${CEE_CURRENT_LIST_DIR}RigEclipseWellLogExtractor.cpp ${CEE_CURRENT_LIST_DIR}RigEclipseWellLogExtractor.cpp
${CEE_CURRENT_LIST_DIR}RigLocalGrid.cpp ${CEE_CURRENT_LIST_DIR}RigLocalGrid.cpp

View File

@@ -25,7 +25,7 @@
#include <cmath> #include <cmath>
RigActiveCellsResultAccessor::RigActiveCellsResultAccessor(const RigGridBase* grid, std::vector<double>* reservoirResultValues, const RigActiveCellInfo* activeCellInfo) RigActiveCellsResultAccessor::RigActiveCellsResultAccessor(const RigGridBase* grid, const std::vector<double>* reservoirResultValues, const RigActiveCellInfo* activeCellInfo)
: m_grid(grid), : m_grid(grid),
m_reservoirResultValues(reservoirResultValues), m_reservoirResultValues(reservoirResultValues),
m_activeCellInfo(activeCellInfo) m_activeCellInfo(activeCellInfo)

View File

@@ -31,7 +31,7 @@ class RigActiveCellInfo;
class RigActiveCellsResultAccessor : public RigResultAccessor class RigActiveCellsResultAccessor : public RigResultAccessor
{ {
public: public:
RigActiveCellsResultAccessor(const RigGridBase* grid, std::vector<double>* reservoirResultValues, const RigActiveCellInfo* activeCellInfo); RigActiveCellsResultAccessor(const RigGridBase* grid, const std::vector<double>* reservoirResultValues, const RigActiveCellInfo* activeCellInfo);
virtual double cellScalar(size_t gridLocalCellIndex) const; virtual double cellScalar(size_t gridLocalCellIndex) const;
virtual double cellFaceScalar(size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId) const; virtual double cellFaceScalar(size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId) const;
@@ -42,6 +42,6 @@ public:
private: private:
const RigActiveCellInfo* m_activeCellInfo; const RigActiveCellInfo* m_activeCellInfo;
const RigGridBase* m_grid; const RigGridBase* m_grid;
std::vector<double>* m_reservoirResultValues; const std::vector<double>* m_reservoirResultValues;
}; };

View File

@@ -0,0 +1,56 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <string>
#include <set>
#define RIG_FLD_TOF_RESNAME "TOF"
#define RIG_FLD_CELL_FRACTION_RESNAME "Fraction"
#define RIG_FLD_MAX_FRACTION_TRACER_RESNAME "MaxFractionTracer"
#define RIG_FLD_COMMUNICATION_RESNAME "Communication"
class RigFlowDiagResultAddress
{
public:
RigFlowDiagResultAddress(const std::string& aVariableName, const std::set<std::string>& someSelectedTracerNames)
: variableName(aVariableName), selectedTracerNames(someSelectedTracerNames) {}
RigFlowDiagResultAddress(const std::string& aVariableName, const std::string& tracerName)
: variableName(aVariableName)
{
selectedTracerNames.insert(tracerName);
}
bool isNativeResult() { return ( ( (variableName == RIG_FLD_TOF_RESNAME) || (variableName == RIG_FLD_CELL_FRACTION_RESNAME) ) && selectedTracerNames.size() <= 1); }
std::string variableName;
std::set<std::string> selectedTracerNames;
bool operator< (const RigFlowDiagResultAddress& other) const
{
if ( selectedTracerNames != other.selectedTracerNames )
{
return selectedTracerNames < other.selectedTracerNames;
}
return variableName < other.variableName;
}
};

View File

@@ -0,0 +1,64 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions 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 <stdlib.h>
#include "RigFlowDiagResultFrames.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFlowDiagResultFrames::RigFlowDiagResultFrames(size_t frameCount)
{
m_dataForEachFrame.resize(frameCount);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFlowDiagResultFrames::~RigFlowDiagResultFrames()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RigFlowDiagResultFrames::frameCount() const
{
return m_dataForEachFrame.size();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double>& RigFlowDiagResultFrames::frameData(size_t frameIndex)
{
return m_dataForEachFrame[frameIndex];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<double>& RigFlowDiagResultFrames::frameData(size_t frameIndex) const
{
return m_dataForEachFrame[frameIndex];
}

View File

@@ -0,0 +1,41 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cvfBase.h"
#include "cvfObject.h"
#include <vector>
class RigFlowDiagResultFrames: public cvf::Object
{
public:
RigFlowDiagResultFrames(size_t frameCount);
virtual ~RigFlowDiagResultFrames();
const
std::vector<double>& frameData(size_t frameIndex) const;
std::vector<double>& frameData(size_t frameIndex);
size_t frameCount() const;
private:
std::vector< std::vector<double> > m_dataForEachFrame;
};

View File

@@ -0,0 +1,47 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RigFlowDiagResults.h"
#include "RigFlowDiagSolverInterface.h"
#include "RimFlowDiagSolution.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFlowDiagResults::RigFlowDiagResults(RimFlowDiagSolution* flowSolution)
: m_flowDiagSolution()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFlowDiagResults::~RigFlowDiagResults()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<double>* RigFlowDiagResults::resultValues(const RigFlowDiagResultAddress& resVarAddr, size_t frameIndex)
{
return nullptr; // Todo
}

View File

@@ -0,0 +1,68 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RigFlowDiagResultAddress.h"
#include "cvfBase.h"
#include "cvfObject.h"
#include <vector>
#include <map>
#include <string>
#include "RigFlowDiagResultFrames.h"
#include "RigStatisticsDataCache.h"
#include "cafPdmPointer.h"
class RigFlowDiagSolverInterface;
class RimFlowDiagSolution;
class RigFlowDiagResults: public cvf::Object
{
public:
RigFlowDiagResults(RimFlowDiagSolution* flowSolution);
virtual ~RigFlowDiagResults();
void initResultSteps(size_t timeStepCount);
const std::vector<double>* resultValues(const RigFlowDiagResultAddress& resVarAddr, size_t frameIndex);
private:
std::vector<double>* findOrCalculateResult (const RigFlowDiagResultAddress& resVarAddr, size_t frameIndex);
std::vector<double>* calculateDerivedResult(const RigFlowDiagResultAddress& resVarAddr, size_t frameIndex);
void calculateFractionWeightedTOF ( size_t timeStepIdx, std::set<std::string> selectedTracerNames);
void calculateSumOfFractions ( size_t timeStepIdx, std::set<std::string> selectedTracerNames);
void calculateTracerWithMaxFraction( size_t timeStepIdx, std::set<std::string> selectedTracerNames); // Needs a tracer index
void calculateCommunication ( size_t timeStepIdx, std::set<std::string> selectedTracerNames);
RigFlowDiagResultFrames* createScalarResult(const RigFlowDiagResultAddress& resVarAddr);
RigFlowDiagResultFrames* findScalarResult (const RigFlowDiagResultAddress& resVarAddr);
void deleteScalarResult(const RigFlowDiagResultAddress& resVarAddr);
size_t m_timeStepCount;
std::map< RigFlowDiagResultAddress, cvf::ref<RigFlowDiagResultFrames> > m_resultSets;
std::map< RigFlowDiagResultAddress, cvf::ref<RigStatisticsDataCache> > m_resultStatistics;
cvf::ref<RigFlowDiagSolverInterface> m_flowDagSolverInterface;
caf::PdmPointer<RimFlowDiagSolution> m_flowDiagSolution;
};

View File

@@ -0,0 +1,53 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RigFlowDiagSolverInterface.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFlowDiagTimeStepResult::RigFlowDiagTimeStepResult(size_t activeCellCount)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFlowDiagSolverInterface::RigFlowDiagSolverInterface(RimEclipseResultCase* eclCase)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFlowDiagSolverInterface::~RigFlowDiagSolverInterface()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<RigFlowDiagTimeStepResult> RigFlowDiagSolverInterface::calculate(size_t timestep, const std::vector<RigTracerCells > & allTracerData)
{
return new RigFlowDiagTimeStepResult(0);
}

View File

@@ -0,0 +1,74 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- 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>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RigFlowDiagResultAddress.h"
#include "cvfBase.h"
#include "cvfObject.h"
#include "cafPdmPointer.h"
#include <string>
#include <vector>
#include <map>
class RimEclipseResultCase;
struct RigTracerCells
{
std::string tracerName;
std::vector<int> tracerCellActiveIndices;
};
class RigFlowDiagTimeStepResult: public cvf::Object
{
public:
RigFlowDiagTimeStepResult(size_t activeCellCount);
void setInjectorTracerTOF (const std::string& tracerName, const std::map<int, double>& cellValues);
void setInjectorTracerFraction(const std::string& tracerName, const std::map<int, double>& cellValues);
void setProducerTracerTOF (const std::string& tracerName, const std::map<int, double>& cellValues);
void setProducerTracerFraction(const std::string& tracerName, const std::map<int, double>& cellValues);
std::vector<double>& nativeResult(const RigFlowDiagResultAddress& resAddr); // Use to "steal" the data from this one using swap
private:
void addResult(const RigFlowDiagResultAddress& resAddr, const std::map<int, double>& cellValues);
std::map<RigFlowDiagResultAddress, std::vector<double> > m_nativeResults;
};
class RigFlowDiagSolverInterface : public cvf::Object
{
public:
RigFlowDiagSolverInterface(RimEclipseResultCase* eclCase);
virtual ~RigFlowDiagSolverInterface();
cvf::ref<RigFlowDiagTimeStepResult> calculate(size_t timestep, const std::vector<RigTracerCells > & allTracerData);
private:
caf::PdmPointer<RimEclipseResultCase> m_eclipseCase;
};

View File

@@ -38,6 +38,8 @@
#include "cvfObject.h" #include "cvfObject.h"
#include <math.h> #include <math.h>
#include "RimFlowDiagSolution.h"
#include "RigFlowDiagResults.h"
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@@ -177,8 +179,11 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createFromResultDefinition
{ {
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(resultDefinition->porosityModel()); RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(resultDefinition->porosityModel());
if (resultDefinition->resultType() != RimDefines::FLOW_DIAGNOSTICS)
{
size_t adjustedTimeStepIndex = timeStepIndex; size_t adjustedTimeStepIndex = timeStepIndex;
if (resultDefinition->hasStaticResult()) if ( resultDefinition->hasStaticResult() )
{ {
adjustedTimeStepIndex = 0; adjustedTimeStepIndex = 0;
} }
@@ -188,6 +193,22 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createFromResultDefinition
porosityModel, porosityModel,
adjustedTimeStepIndex, adjustedTimeStepIndex,
resultDefinition->resultVariable()); resultDefinition->resultVariable());
}
else
{
RimFlowDiagSolution* flowSol = resultDefinition->flowDiagSolution();
if (!flowSol) return new RigHugeValResultAccessor;;
const std::vector<double>* resultValues = flowSol->flowDiagResults()->resultValues( resultDefinition->flowDiagResAddress(), timeStepIndex);
if (!resultValues) return new RigHugeValResultAccessor;
RigGridBase* grid = eclipseCase->grid(gridIndex);
if ( !grid ) return new RigHugeValResultAccessor;
cvf::ref<RigResultAccessor> object = new RigActiveCellsResultAccessor(grid, resultValues, eclipseCase->activeCellInfo(porosityModel));
return object;
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------