Added internal MULTXYZ fields to TransMult
This commit is contained in:
parent
61c4e677c5
commit
5411f9ec74
@ -28,7 +28,14 @@ namespace Opm {
|
||||
m_ny(ny),
|
||||
m_nz(nz)
|
||||
{
|
||||
m_names[FaceDir::XPlus] = "MULTX";
|
||||
m_names[FaceDir::YPlus] = "MULTY";
|
||||
m_names[FaceDir::ZPlus] = "MULTZ";
|
||||
m_names[FaceDir::XMinus] = "MULTX-";
|
||||
m_names[FaceDir::YMinus] = "MULTY-";
|
||||
m_names[FaceDir::ZMinus] = "MULTZ-";
|
||||
}
|
||||
|
||||
|
||||
|
||||
void TransMult::assertIJK(size_t i , size_t j , size_t k) const {
|
||||
@ -43,16 +50,73 @@ namespace Opm {
|
||||
}
|
||||
|
||||
|
||||
double TransMult::getMultiplier(size_t globalIndex, FaceDir::DirEnum /* Unused for now: faceDir*/) const {
|
||||
double TransMult::getMultiplier(size_t globalIndex, FaceDir::DirEnum faceDir) const {
|
||||
if (globalIndex < m_nx * m_ny * m_nz)
|
||||
return 1.0;
|
||||
return getMultiplier__(globalIndex , faceDir);
|
||||
else
|
||||
throw std::invalid_argument("Invalid global index");
|
||||
}
|
||||
|
||||
double TransMult::getMultiplier__(size_t globalIndex, FaceDir::DirEnum faceDir) const {
|
||||
if (hasDirectionProperty( faceDir )) {
|
||||
std::shared_ptr<const GridProperty<double> > property = m_trans.at(faceDir);
|
||||
return property->iget( globalIndex );
|
||||
} else
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
double TransMult::getMultiplier(size_t i , size_t j , size_t k, FaceDir::DirEnum faceDir) const {
|
||||
size_t globalIndex = getGlobalIndex(i,j,k);
|
||||
return getMultiplier( globalIndex , faceDir );
|
||||
return getMultiplier__( globalIndex , faceDir );
|
||||
}
|
||||
|
||||
|
||||
bool TransMult::hasDirectionProperty(FaceDir::DirEnum faceDir) const {
|
||||
if (m_trans.count(faceDir) == 1)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void TransMult::insertNewProperty(FaceDir::DirEnum faceDir) {
|
||||
GridPropertySupportedKeywordInfo<double> kwInfo(m_names[faceDir] , 1.0 , "1");
|
||||
std::shared_ptr<GridProperty<double> > property = std::make_shared<GridProperty<double> >( m_nx , m_ny , m_nz , kwInfo );
|
||||
std::pair<FaceDir::DirEnum , std::shared_ptr<GridProperty<double> > > pair(faceDir , property);
|
||||
|
||||
m_trans.insert( pair );
|
||||
}
|
||||
|
||||
|
||||
std::shared_ptr<GridProperty<double> > TransMult::getDirectionProperty(FaceDir::DirEnum faceDir) {
|
||||
if (m_trans.count(faceDir) == 0)
|
||||
insertNewProperty(faceDir);
|
||||
|
||||
return m_trans.at( faceDir );
|
||||
}
|
||||
|
||||
|
||||
void TransMult::applyMULTFLT( std::shared_ptr<const FaultCollection> faults) {
|
||||
for (size_t faultIndex = 0; faultIndex < faults->size(); faultIndex++) {
|
||||
std::shared_ptr<const Fault> fault = faults->getFault( faultIndex );
|
||||
double transMult = fault->getTransMult();
|
||||
|
||||
for (auto face_iter = fault->begin(); face_iter != fault->end(); ++face_iter) {
|
||||
std::shared_ptr<const FaultFace> face = *face_iter;
|
||||
FaceDir::DirEnum faceDir = face->getDir();
|
||||
std::shared_ptr<GridProperty<double> > multProperty = getDirectionProperty(faceDir);
|
||||
std::vector<double>& data = multProperty->getData();
|
||||
|
||||
for (auto cell_iter = face->begin(); cell_iter != face->end(); ++cell_iter) {
|
||||
size_t globalIndex = *cell_iter;
|
||||
data[globalIndex] *= transMult;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -31,7 +31,10 @@
|
||||
|
||||
|
||||
#include <cstddef>
|
||||
#include <map>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/FaceDir.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/GridProperty.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/FaultCollection.hpp>
|
||||
|
||||
|
||||
namespace Opm {
|
||||
@ -41,12 +44,19 @@ namespace Opm {
|
||||
TransMult(size_t nx , size_t ny , size_t nz);
|
||||
double getMultiplier(size_t globalIndex, FaceDir::DirEnum faceDir) const;
|
||||
double getMultiplier(size_t i , size_t j , size_t k, FaceDir::DirEnum faceDir) const;
|
||||
bool hasDirectionProperty(FaceDir::DirEnum faceDir) const;
|
||||
std::shared_ptr<GridProperty<double> > getDirectionProperty(FaceDir::DirEnum faceDir);
|
||||
void applyMULTFLT( std::shared_ptr<const FaultCollection> faults);
|
||||
|
||||
private:
|
||||
size_t getGlobalIndex(size_t i , size_t j , size_t k) const;
|
||||
void assertIJK(size_t i , size_t j , size_t k) const;
|
||||
|
||||
double getMultiplier__(size_t globalIndex , FaceDir::DirEnum faceDir) const;
|
||||
void insertNewProperty(FaceDir::DirEnum faceDir);
|
||||
|
||||
size_t m_nx , m_ny , m_nz;
|
||||
std::map<FaceDir::DirEnum , std::shared_ptr<GridProperty<double> > > m_trans;
|
||||
std::map<FaceDir::DirEnum , std::string> m_names;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/TransMult.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/GridProperty.hpp>
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Empty) {
|
||||
Opm::TransMult transMult(10,10,10);
|
||||
@ -39,4 +40,11 @@ BOOST_AUTO_TEST_CASE(Empty) {
|
||||
|
||||
BOOST_CHECK_EQUAL( transMult.getMultiplier(9,9,9, Opm::FaceDir::YMinus) , 1.0 );
|
||||
BOOST_CHECK_EQUAL( transMult.getMultiplier(100 , Opm::FaceDir::ZMinus) , 1.0 );
|
||||
|
||||
BOOST_CHECK( !transMult.hasDirectionProperty( Opm::FaceDir::XPlus ));
|
||||
BOOST_CHECK( !transMult.hasDirectionProperty( Opm::FaceDir::ZMinus ));
|
||||
|
||||
std::shared_ptr<Opm::GridProperty<double> > mult = transMult.getDirectionProperty( Opm::FaceDir::ZPlus );
|
||||
BOOST_CHECK_EQUAL( mult->getKeywordName() , "MULTZ");
|
||||
BOOST_CHECK( transMult.hasDirectionProperty( Opm::FaceDir::ZPlus ));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user