2014-06-23 07:52:55 +02:00
|
|
|
/*
|
|
|
|
|
Copyright 2014 Statoil ASA.
|
|
|
|
|
|
|
|
|
|
This file is part of the Open Porous Media project (OPM).
|
|
|
|
|
|
|
|
|
|
OPM 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.
|
|
|
|
|
|
|
|
|
|
OPM 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 for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
2016-06-20 12:27:56 +02:00
|
|
|
|
2014-06-23 07:52:55 +02:00
|
|
|
#include <stdexcept>
|
|
|
|
|
|
2016-10-12 10:46:40 +02:00
|
|
|
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Eclipse3DProperties.hpp>
|
2016-01-15 08:42:57 +01:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/Fault.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/FaultFace.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/FaultCollection.hpp>
|
2016-06-20 12:27:56 +02:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/GridProperty.hpp>
|
2014-06-23 07:52:55 +02:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/TransMult.hpp>
|
2017-09-24 15:17:10 +02:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/GridDims.hpp>
|
2016-01-15 08:42:57 +01:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/MULTREGTScanner.hpp>
|
2014-06-23 07:52:55 +02:00
|
|
|
|
2016-06-20 12:27:56 +02:00
|
|
|
|
2014-06-23 07:52:55 +02:00
|
|
|
namespace Opm {
|
|
|
|
|
|
2017-09-24 15:17:10 +02:00
|
|
|
TransMult::TransMult(const GridDims& dims, const Deck& deck, const Eclipse3DProperties& props) :
|
2016-10-12 10:46:40 +02:00
|
|
|
m_names( { { FaceDir::XPlus, "MULTX" },
|
|
|
|
|
{ FaceDir::YPlus, "MULTY" },
|
|
|
|
|
{ FaceDir::ZPlus, "MULTZ" },
|
|
|
|
|
{ FaceDir::XMinus, "MULTX-" },
|
|
|
|
|
{ FaceDir::YMinus, "MULTY-" },
|
2017-09-24 15:17:10 +02:00
|
|
|
{ FaceDir::ZMinus, "MULTZ-" }}),
|
|
|
|
|
m_nx( dims.getNX()),
|
|
|
|
|
m_ny( dims.getNY()),
|
|
|
|
|
m_nz( dims.getNZ()),
|
|
|
|
|
m_multregtScanner( props, deck.getKeywordList( "MULTREGT" ))
|
|
|
|
|
{
|
|
|
|
|
}
|
2014-06-23 07:52:55 +02:00
|
|
|
|
|
|
|
|
void TransMult::assertIJK(size_t i , size_t j , size_t k) const {
|
|
|
|
|
if ((i >= m_nx) || (j >= m_ny) || (k >= m_nz))
|
|
|
|
|
throw std::invalid_argument("Invalid ijk");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
size_t TransMult::getGlobalIndex(size_t i , size_t j , size_t k) const {
|
|
|
|
|
assertIJK(i,j,k);
|
|
|
|
|
return i + j*m_nx + k*m_nx*m_ny;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2014-07-05 13:46:53 +02:00
|
|
|
double TransMult::getMultiplier(size_t globalIndex, FaceDir::DirEnum faceDir) const {
|
2014-06-23 07:52:55 +02:00
|
|
|
if (globalIndex < m_nx * m_ny * m_nz)
|
2014-07-05 13:46:53 +02:00
|
|
|
return getMultiplier__(globalIndex , faceDir);
|
2014-06-23 07:52:55 +02:00
|
|
|
else
|
|
|
|
|
throw std::invalid_argument("Invalid global index");
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-05 13:46:53 +02:00
|
|
|
double TransMult::getMultiplier__(size_t globalIndex, FaceDir::DirEnum faceDir) const {
|
|
|
|
|
if (hasDirectionProperty( faceDir )) {
|
2016-03-08 17:07:42 +01:00
|
|
|
return m_trans.at(faceDir).iget( globalIndex );
|
2014-07-05 13:46:53 +02:00
|
|
|
} else
|
|
|
|
|
return 1.0;
|
|
|
|
|
}
|
2014-12-08 16:34:28 +01:00
|
|
|
|
|
|
|
|
|
2014-07-05 13:46:53 +02:00
|
|
|
|
2014-06-23 07:52:55 +02:00
|
|
|
|
|
|
|
|
double TransMult::getMultiplier(size_t i , size_t j , size_t k, FaceDir::DirEnum faceDir) const {
|
|
|
|
|
size_t globalIndex = getGlobalIndex(i,j,k);
|
2014-07-05 13:46:53 +02:00
|
|
|
return getMultiplier__( globalIndex , faceDir );
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-05 11:14:53 +01:00
|
|
|
double TransMult::getRegionMultiplier(size_t globalCellIndex1, size_t globalCellIndex2, FaceDir::DirEnum faceDir) const {
|
2016-10-12 10:46:40 +02:00
|
|
|
return m_multregtScanner.getRegionMultiplier(globalCellIndex1, globalCellIndex2, faceDir);
|
2014-12-05 11:14:53 +01:00
|
|
|
}
|
|
|
|
|
|
2014-07-05 13:46:53 +02:00
|
|
|
bool TransMult::hasDirectionProperty(FaceDir::DirEnum faceDir) const {
|
2016-03-08 17:07:42 +01:00
|
|
|
return m_trans.count(faceDir) == 1;
|
2014-07-05 13:46:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TransMult::insertNewProperty(FaceDir::DirEnum faceDir) {
|
|
|
|
|
GridPropertySupportedKeywordInfo<double> kwInfo(m_names[faceDir] , 1.0 , "1");
|
2016-03-08 17:07:42 +01:00
|
|
|
GridProperty< double > prop( m_nx, m_ny, m_nz, kwInfo );
|
|
|
|
|
m_trans.emplace( faceDir, std::move( prop ) );
|
2014-07-05 13:46:53 +02:00
|
|
|
}
|
|
|
|
|
|
2014-12-08 16:34:28 +01:00
|
|
|
|
2016-03-08 17:07:42 +01:00
|
|
|
GridProperty<double>& TransMult::getDirectionProperty(FaceDir::DirEnum faceDir) {
|
2014-12-08 16:34:28 +01:00
|
|
|
if (m_trans.count(faceDir) == 0)
|
2014-07-05 13:46:53 +02:00
|
|
|
insertNewProperty(faceDir);
|
2014-12-08 16:34:28 +01:00
|
|
|
|
2014-07-05 13:46:53 +02:00
|
|
|
return m_trans.at( faceDir );
|
|
|
|
|
}
|
2014-07-15 14:09:56 +02:00
|
|
|
|
2016-03-08 17:07:42 +01:00
|
|
|
void TransMult::applyMULT(const GridProperty<double>& srcProp, FaceDir::DirEnum faceDir)
|
2014-07-15 14:09:56 +02:00
|
|
|
{
|
2016-03-08 17:07:42 +01:00
|
|
|
auto& dstProp = getDirectionProperty(faceDir);
|
2014-07-15 14:09:56 +02:00
|
|
|
|
2016-03-08 17:07:42 +01:00
|
|
|
const std::vector<double> &srcData = srcProp.getData();
|
2014-07-15 14:09:56 +02:00
|
|
|
for (size_t i = 0; i < srcData.size(); ++i)
|
2016-03-08 17:07:42 +01:00
|
|
|
dstProp.multiplyValueAtIndex(i, srcData[i]);
|
2014-07-15 14:09:56 +02:00
|
|
|
}
|
2014-07-05 13:46:53 +02:00
|
|
|
|
|
|
|
|
|
2016-05-02 17:50:45 +02:00
|
|
|
void TransMult::applyMULTFLT(const Fault& fault) {
|
|
|
|
|
double transMult = fault.getTransMult();
|
2014-12-08 16:34:28 +01:00
|
|
|
|
2016-10-07 15:19:22 +02:00
|
|
|
for( const auto& face : fault ) {
|
|
|
|
|
FaceDir::DirEnum faceDir = face.getDir();
|
2016-03-08 17:07:42 +01:00
|
|
|
auto& multProperty = getDirectionProperty(faceDir);
|
2015-11-02 12:17:05 +01:00
|
|
|
|
2016-10-07 15:19:22 +02:00
|
|
|
|
|
|
|
|
for( auto globalIndex : face ) {
|
2016-03-08 17:07:42 +01:00
|
|
|
multProperty.multiplyValueAtIndex( globalIndex , transMult);
|
2014-07-05 13:46:53 +02:00
|
|
|
}
|
2015-11-02 12:17:05 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-08 16:34:28 +01:00
|
|
|
|
2016-05-02 17:50:45 +02:00
|
|
|
void TransMult::applyMULTFLT(const FaultCollection& faults) {
|
|
|
|
|
for (size_t faultIndex = 0; faultIndex < faults.size(); faultIndex++) {
|
|
|
|
|
auto& fault = faults.getFault(faultIndex);
|
|
|
|
|
applyMULTFLT(fault);
|
2014-07-05 13:46:53 +02:00
|
|
|
}
|
2014-06-23 07:52:55 +02:00
|
|
|
}
|
2017-09-24 15:17:10 +02:00
|
|
|
}
|