riTRANSXYZ: Removed unused code

This commit is contained in:
Jacob Støren 2014-08-26 13:36:38 +02:00
parent 27571a839a
commit 28f5639607
5 changed files with 87 additions and 422 deletions

View File

@ -601,100 +601,103 @@ void RimReservoirCellResultsStorage::computeDepthRelatedResults()
}
}
#if 1
void calculateConnectionGeometry(const RigCell& c1, const RigCell& c2 , const std::vector<cvf::Vec3d>& nodes,
cvf::StructGridInterface::FaceType faceId,
cvf::Vec3d* faceCenter, cvf::Vec3d* faceAreaVec)
namespace RigTransmissibilityCalcTools
{
CVF_TIGHT_ASSERT(faceCenter && faceAreaVec);
*faceCenter = cvf::Vec3d::ZERO;
*faceAreaVec = cvf::Vec3d::ZERO;
std::vector<size_t> polygon;
std::vector<cvf::Vec3d> intersections;
caf::SizeTArray4 face1;
caf::SizeTArray4 face2;
c1.faceIndices(faceId, &face1);
c2.faceIndices(cvf::StructGridInterface::oppositeFace(faceId), &face2);
bool foundOverlap = cvf::GeometryTools::calculateOverlapPolygonOfTwoQuads(
&polygon,
&intersections,
(cvf::EdgeIntersectStorage<size_t>*)NULL,
cvf::wrapArrayConst(&nodes),
face1.data(),
face2.data(),
1e-6);
if (foundOverlap)
void calculateConnectionGeometry(const RigCell& c1, const RigCell& c2, const std::vector<cvf::Vec3d>& nodes,
cvf::StructGridInterface::FaceType faceId,
cvf::Vec3d* faceCenter, cvf::Vec3d* faceAreaVec)
{
std::vector<cvf::Vec3d> realPolygon;
CVF_TIGHT_ASSERT(faceCenter && faceAreaVec);
for (size_t pIdx = 0; pIdx < polygon.size(); ++pIdx)
*faceCenter = cvf::Vec3d::ZERO;
*faceAreaVec = cvf::Vec3d::ZERO;
std::vector<size_t> polygon;
std::vector<cvf::Vec3d> intersections;
caf::SizeTArray4 face1;
caf::SizeTArray4 face2;
c1.faceIndices(faceId, &face1);
c2.faceIndices(cvf::StructGridInterface::oppositeFace(faceId), &face2);
bool foundOverlap = cvf::GeometryTools::calculateOverlapPolygonOfTwoQuads(
&polygon,
&intersections,
(cvf::EdgeIntersectStorage<size_t>*)NULL,
cvf::wrapArrayConst(&nodes),
face1.data(),
face2.data(),
1e-6);
if (foundOverlap)
{
if (polygon[pIdx] < nodes.size())
realPolygon.push_back(nodes[polygon[pIdx]]);
else
realPolygon.push_back(intersections[polygon[pIdx] - nodes.size()]);
std::vector<cvf::Vec3d> realPolygon;
for (size_t pIdx = 0; pIdx < polygon.size(); ++pIdx)
{
if (polygon[pIdx] < nodes.size())
realPolygon.push_back(nodes[polygon[pIdx]]);
else
realPolygon.push_back(intersections[polygon[pIdx] - nodes.size()]);
}
// Polygon center
for (size_t pIdx = 0; pIdx < realPolygon.size(); ++pIdx)
{
*faceCenter += realPolygon[pIdx];
}
*faceCenter *= 1.0 / realPolygon.size();
// Polygon area vector
*faceAreaVec = cvf::GeometryTools::polygonAreaNormal3D(realPolygon);
}
// Polygon center
for (size_t pIdx = 0; pIdx < realPolygon.size(); ++pIdx)
{
*faceCenter += realPolygon[pIdx];
}
*faceCenter *= 1.0 / realPolygon.size();
// Polygon area vector
*faceAreaVec = cvf::GeometryTools::polygonAreaNormal3D(realPolygon);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double halfCellTransmissibility(double perm, double ntg, const cvf::Vec3d& centerToFace, const cvf::Vec3d& faceAreaVec)
{
return perm*ntg*(faceAreaVec*centerToFace) / (centerToFace*centerToFace);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double newtran(double cdarchy, double mult, double halfCellTrans, double neighborHalfCellTrans)
{
return cdarchy * mult / ((1 / halfCellTrans) + (1 / neighborHalfCellTrans));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
typedef size_t(*ResultIndexFunction)(const RigActiveCellInfo* activeCellinfo, size_t reservoirCellIndex);
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t directReservoirCellIndex(const RigActiveCellInfo* activeCellinfo, size_t reservoirCellIndex)
{
return reservoirCellIndex;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t reservoirActiveCellIndex(const RigActiveCellInfo* activeCellinfo, size_t reservoirCellIndex)
{
return activeCellinfo->cellResultIndex(reservoirCellIndex);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double halfCellTransmissibility(double perm, double ntg, const cvf::Vec3d& centerToFace, const cvf::Vec3d& faceAreaVec)
{
return perm*ntg*(faceAreaVec*centerToFace) / (centerToFace*centerToFace);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double newtran(double cdarchy, double mult, double halfCellTrans, double neighborHalfCellTrans)
{
return cdarchy * mult / ((1 / halfCellTrans) + (1 / neighborHalfCellTrans));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
typedef size_t (*ResultIndexFunction)(const RigActiveCellInfo* activeCellinfo, size_t reservoirCellIndex);
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t directReservoirCellIndex(const RigActiveCellInfo* activeCellinfo, size_t reservoirCellIndex)
{
return reservoirCellIndex;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t reservoirActiveCellIndex(const RigActiveCellInfo* activeCellinfo, size_t reservoirCellIndex)
{
return activeCellinfo->cellResultIndex(reservoirCellIndex);
}
using namespace RigTransmissibilityCalcTools;
//--------------------------------------------------------------------------------------------------
///
@ -864,7 +867,6 @@ void RimReservoirCellResultsStorage::computeRiTransComponent(const QString& riTr
}
}
#if 1
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -1023,11 +1025,9 @@ void RimReservoirCellResultsStorage::computeNncCombRiTrans()
double newtranTemp = newtran(cdarchy, 1.0, halfCellTrans, neighborHalfCellTrans);
riCombTransResults[connIdx] = newtranTemp;
}
#endif
}
#endif
//--------------------------------------------------------------------------------------------------
///

View File

@ -17,7 +17,6 @@ ${CEE_CURRENT_LIST_DIR}RigActiveCellsResultAccessor.h
${CEE_CURRENT_LIST_DIR}RigCellEdgeResultAccessor.h
${CEE_CURRENT_LIST_DIR}RigCombTransResultAccessor.h
${CEE_CURRENT_LIST_DIR}RigCombMultResultAccessor.h
${CEE_CURRENT_LIST_DIR}RigCombRiTransResultAccessor.h
${CEE_CURRENT_LIST_DIR}RigResultModifier.h
${CEE_CURRENT_LIST_DIR}RigResultModifierFactory.h
${CEE_CURRENT_LIST_DIR}RigLocalGrid.h
@ -51,7 +50,6 @@ ${CEE_CURRENT_LIST_DIR}RigActiveCellsResultAccessor.cpp
${CEE_CURRENT_LIST_DIR}RigCellEdgeResultAccessor.cpp
${CEE_CURRENT_LIST_DIR}RigCombTransResultAccessor.cpp
${CEE_CURRENT_LIST_DIR}RigCombMultResultAccessor.cpp
${CEE_CURRENT_LIST_DIR}RigCombRiTransResultAccessor.cpp
${CEE_CURRENT_LIST_DIR}RigResultModifierFactory.cpp
${CEE_CURRENT_LIST_DIR}RigLocalGrid.cpp
${CEE_CURRENT_LIST_DIR}RigMainGrid.cpp

View File

@ -1,248 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Statoil ASA, 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 "RigCombRiTransResultAccessor.h"
#include "RigMainGrid.h"
#include "RigGridBase.h"
#include "RigCell.h"
#include <cmath>
#include "cvfGeometryTools.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigCombRiTransResultAccessor::RigCombRiTransResultAccessor(const RigGridBase* grid)
: m_grid(grid)
{
m_cdarchy = 0.008527; // (ECLIPSE 100) (METRIC)
}
//--------------------------------------------------------------------------------------------------
/// Only sensible to provide the positive values, as the negative ones will never be used.
/// The negative faces gets their value from the neighbor cell in that direction
//--------------------------------------------------------------------------------------------------
void RigCombRiTransResultAccessor::setPermResultAccessors( RigResultAccessor* xPermAccessor,
RigResultAccessor* yPermAccessor,
RigResultAccessor* zPermAccessor)
{
m_xPermAccessor = xPermAccessor;
m_yPermAccessor = yPermAccessor;
m_zPermAccessor = zPermAccessor;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigCombRiTransResultAccessor::setNTGResultAccessor(RigResultAccessor* ntgAccessor)
{
m_ntgAccessor = ntgAccessor;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigCombRiTransResultAccessor::cellScalar(size_t gridLocalCellIndex) const
{
CVF_TIGHT_ASSERT(false);
return HUGE_VAL;
}
double RigCombRiTransResultAccessor::getPermValue(size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId) const
{
switch (faceId)
{
case cvf::StructGridInterface::POS_I:
case cvf::StructGridInterface::NEG_I:
{
return m_xPermAccessor->cellScalar(gridLocalCellIndex);
}
break;
case cvf::StructGridInterface::POS_J:
case cvf::StructGridInterface::NEG_J:
{
return m_yPermAccessor->cellScalar(gridLocalCellIndex);
}
break;
case cvf::StructGridInterface::POS_K:
case cvf::StructGridInterface::NEG_K:
{
return m_zPermAccessor->cellScalar(gridLocalCellIndex);
}
break;
}
return HUGE_VAL;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigCombRiTransResultAccessor::getNtgValue(size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId ) const
{
double ntg = 1.0;
if (faceId != cvf::StructGridInterface::POS_K && faceId != cvf::StructGridInterface::NEG_K)
{
m_ntgAccessor->cellScalar(gridLocalCellIndex);
}
return ntg;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigCombRiTransResultAccessor::halfCellTransmissibility(double perm, double ntg, const cvf::Vec3d& centerToFace, const cvf::Vec3d& faceAreaVec)
{
return perm*ntg*(faceAreaVec*centerToFace) / (centerToFace*centerToFace);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigCombRiTransResultAccessor::newtran(double cdarchy, double mult, double halfCellTrans, double neighborHalfCellTrans)
{
return cdarchy * mult / ( ( 1 / halfCellTrans) + (1 / neighborHalfCellTrans) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigCombRiTransResultAccessor::calculateHalfCellTrans(size_t gridLocalCellIndex, size_t neighborGridCellIdx, cvf::StructGridInterface::FaceType faceId, bool isFaultFace) const
{
const RigCell& cell = m_grid->cell(gridLocalCellIndex);
cvf::Vec3d faceAreaVec;
cvf::Vec3d faceCenter;
if (isFaultFace)
{
calculateConnectionGeometry( m_grid, gridLocalCellIndex, neighborGridCellIdx, faceId, &faceCenter, &faceAreaVec);
}
else
{
const RigCell& cell = m_grid->cell(gridLocalCellIndex);
faceCenter = cell.faceCenter(faceId);
faceAreaVec = cell.faceNormalWithAreaLenght(faceId);
}
cvf::Vec3d centerToFace = faceCenter - cell.center();
double perm = getPermValue(gridLocalCellIndex, faceId);
double ntg = getNtgValue(gridLocalCellIndex, faceId );
return halfCellTransmissibility(perm, ntg, centerToFace, faceAreaVec);
}
void RigCombRiTransResultAccessor::calculateConnectionGeometry( const RigGridBase* grid, size_t gridLocalCellIndex, size_t neighborGridCellIdx,
cvf::StructGridInterface::FaceType faceId,
cvf::Vec3d* faceCenter, cvf::Vec3d* faceAreaVec)
{
CVF_TIGHT_ASSERT(faceCenter && faceAreaVec);
*faceCenter = cvf::Vec3d::ZERO;
*faceAreaVec = cvf::Vec3d::ZERO;
const RigMainGrid* mainGrid = grid->mainGrid();
const RigCell& c1 = grid->cell(gridLocalCellIndex);
const RigCell& c2 = grid->cell(neighborGridCellIdx);
std::vector<size_t> polygon;
std::vector<cvf::Vec3d> intersections;
caf::SizeTArray4 face1;
caf::SizeTArray4 face2;
c1.faceIndices(faceId, &face1);
c2.faceIndices(cvf::StructGridInterface::oppositeFace(faceId), &face2);
bool foundOverlap = cvf::GeometryTools::calculateOverlapPolygonOfTwoQuads(
&polygon,
&intersections,
(cvf::EdgeIntersectStorage<size_t>*)NULL,
cvf::wrapArrayConst(&(mainGrid->nodes())),
face1.data(),
face2.data(),
1e-6);
if (foundOverlap)
{
std::vector<cvf::Vec3d> realPolygon;
for (size_t pIdx = 0; pIdx < polygon.size(); ++pIdx)
{
if (polygon[pIdx] < grid->mainGrid()->nodes().size())
realPolygon.push_back(grid->mainGrid()->nodes()[polygon[pIdx]]);
else
realPolygon.push_back(intersections[polygon[pIdx] - grid->mainGrid()->nodes().size()]);
}
// Polygon center
for (size_t pIdx = 0; pIdx < realPolygon.size(); ++pIdx)
{
*faceCenter += realPolygon[pIdx];
}
*faceCenter *= 1.0/realPolygon.size();
// Polygon area vector
*faceAreaVec = cvf::GeometryTools::polygonAreaNormal3D(realPolygon);
}
}
//--------------------------------------------------------------------------------------------------
///
/// Neighbor cell transmisibilities only is calculated here
/// Not NNC transmisibilities. That has to be done separately elsewhere
///
/// Todo: What about Grid to Grid connections ?
/// Todo: needs optimization. Things are done several times. Caching of the results should be considered. etc.
///
//--------------------------------------------------------------------------------------------------
double RigCombRiTransResultAccessor::cellFaceScalar(size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId) const
{
size_t i, j, k, neighborGridCellIdx;
m_grid->ijkFromCellIndex(gridLocalCellIndex, &i, &j, &k);
if (m_grid->cellIJKNeighbor(i, j, k, faceId, &neighborGridCellIdx))
{
size_t reservoirCellIndex = m_grid->reservoirCellIndex(gridLocalCellIndex);
const RigFault* fault = m_grid->mainGrid()->findFaultFromCellIndexAndCellFace(reservoirCellIndex, faceId);
bool isOnFault = fault;
double halfCellTrans = 0;
double neighborHalfCellTrans = 0;
halfCellTrans = calculateHalfCellTrans(gridLocalCellIndex, neighborGridCellIdx, faceId, isOnFault);
neighborHalfCellTrans = calculateHalfCellTrans(neighborGridCellIdx, gridLocalCellIndex, cvf::StructGridInterface::oppositeFace(faceId), isOnFault);
return newtran(m_cdarchy, 1.0, halfCellTrans, neighborHalfCellTrans);
}
return HUGE_VAL;
}

View File

@ -1,70 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Statoil ASA, 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RigResultAccessor.h"
#include "cvfCollection.h"
class RigGridBase;
//==================================================================================================
///
//==================================================================================================
class RigCombRiTransResultAccessor : public RigResultAccessor
{
public:
RigCombRiTransResultAccessor(const RigGridBase* grid);
void setPermResultAccessors(RigResultAccessor* xPermAccessor,
RigResultAccessor* yPermAccessor,
RigResultAccessor* zPermAccessor);
void setNTGResultAccessor( RigResultAccessor* ntgAccessor);
/// CDARCY Darcy's constant
/// = 0.00852702 (E300); 0.008527 (ECLIPSE 100) (METRIC)
/// = 0.00112712 (E300); 0.001127 (ECLIPSE 100) (FIELD)
/// = 3.6 (LAB)
/// = 0.00864 (PVT-M)
void setCDARCHY(double cDarchy) { m_cdarchy = cDarchy;}
virtual double cellScalar(size_t gridLocalCellIndex) const;
virtual double cellFaceScalar(size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId) const;
private:
double getPermValue(size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId) const;
double calculateHalfCellTrans( size_t gridLocalCellIndex, size_t neighborGridCellIdx, cvf::StructGridInterface::FaceType faceId, bool isFaultFace) const;
double getNtgValue( size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId ) const;
static void calculateConnectionGeometry( const RigGridBase* grid, size_t gridLocalCellIndex, size_t neighborGridCellIdx, cvf::StructGridInterface::FaceType faceId, cvf::Vec3d* centerToFace, cvf::Vec3d* faceAreaVec);
static double halfCellTransmissibility(double perm, double ntg, const cvf::Vec3d& centerToFace, const cvf::Vec3d& faceAreaVec);
static double newtran(double cdarchy, double mult, double halfCellTrans, double neighborHalfCellTrans);
cvf::ref<RigResultAccessor> m_xPermAccessor;
cvf::ref<RigResultAccessor> m_yPermAccessor;
cvf::ref<RigResultAccessor> m_zPermAccessor;
cvf::ref<RigResultAccessor> m_ntgAccessor;
double m_cdarchy;
const RigGridBase* m_grid;
};

View File

@ -35,7 +35,6 @@
#include "cvfObject.h"
#include <math.h>
#include "RigCombRiTransResultAccessor.h"
//--------------------------------------------------------------------------------------------------
///
@ -91,20 +90,6 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createResultAccessor(RigCa
cellFaceAccessObject->setTransResultAccessors(xTransAccessor.p(), yTransAccessor.p(), zTransAccessor.p());
return cellFaceAccessObject;
#if 0
cvf::ref<RigCombRiTransResultAccessor> cellFaceAccessObject = new RigCombRiTransResultAccessor(grid);
cvf::ref<RigResultAccessor> permX = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, "PERMX");
cvf::ref<RigResultAccessor> permY = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, "PERMY");
cvf::ref<RigResultAccessor> permZ = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, "PERMZ");
cvf::ref<RigResultAccessor> ntg = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, "NTG");
cellFaceAccessObject->setPermResultAccessors(permX.p(), permY.p(), permZ.p());
cellFaceAccessObject->setNTGResultAccessor(ntg.p());
// todo : cellFaceAccessObject->setCDARCHY();
return cellFaceAccessObject;
#endif
}
return RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, uiResultName);