Added transMult container - which only returns 1.0
This commit is contained in:
@@ -78,6 +78,7 @@ EclipseState/Grid/GridProperty.cpp
|
||||
EclipseState/Grid/Box.cpp
|
||||
EclipseState/Grid/BoxManager.cpp
|
||||
EclipseState/Grid/FaceDir.cpp
|
||||
EclipseState/Grid/TransMult.cpp
|
||||
EclipseState/Grid/EclipseGrid.cpp)
|
||||
|
||||
set (utility_source
|
||||
@@ -138,6 +139,7 @@ EclipseState/Grid/GridProperties.hpp
|
||||
EclipseState/Grid/Box.hpp
|
||||
EclipseState/Grid/BoxManager.hpp
|
||||
EclispeState/Grid/FaceDir.hpp
|
||||
EclispeState/Grid/TransMult.hpp
|
||||
#
|
||||
Utility/WconinjeWrapper.hpp
|
||||
Utility/CompdatWrapper.hpp
|
||||
|
||||
58
opm/parser/eclipse/EclipseState/Grid/TransMult.cpp
Normal file
58
opm/parser/eclipse/EclipseState/Grid/TransMult.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
#include <stdexcept>
|
||||
#include <iostream>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/TransMult.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
TransMult::TransMult(size_t nx , size_t ny , size_t nz) :
|
||||
m_nx(nx),
|
||||
m_ny(ny),
|
||||
m_nz(nz)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
double TransMult::getMultiplier(size_t globalIndex, FaceDir::DirEnum /* Unused for now: faceDir*/) const {
|
||||
if (globalIndex < m_nx * m_ny * m_nz)
|
||||
return 1.0;
|
||||
else
|
||||
throw std::invalid_argument("Invalid global index");
|
||||
}
|
||||
|
||||
|
||||
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 );
|
||||
}
|
||||
}
|
||||
54
opm/parser/eclipse/EclipseState/Grid/TransMult.hpp
Normal file
54
opm/parser/eclipse/EclipseState/Grid/TransMult.hpp
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
This class implements a small container which holds the
|
||||
transmissibility mulitpliers for all the faces in the grid. The
|
||||
multipliers in this class are built up from the transmissibility
|
||||
modifier keywords:
|
||||
|
||||
{MULTX , MULTX- , MULTY , MULTY- , MULTZ , MULTZ-, MULTFLT , MULTREGT}
|
||||
|
||||
*/
|
||||
#ifndef TRANSMULT_HPP
|
||||
#define TRANSMULT_HPP
|
||||
|
||||
|
||||
#include <cstddef>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/FaceDir.hpp>
|
||||
|
||||
|
||||
namespace Opm {
|
||||
class TransMult {
|
||||
|
||||
public:
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
size_t m_nx , m_ny , m_nz;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -26,3 +26,8 @@ add_executable(runBoxManagerTests BoxManagerTests.cpp)
|
||||
target_link_libraries(runBoxManagerTests Parser ${Boost_LIBRARIES})
|
||||
add_test(NAME runBoxManagerTests WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${TEST_MEMCHECK_TOOL} ${EXECUTABLE_OUTPUT_PATH}/runBoxManagerTests )
|
||||
|
||||
|
||||
add_executable(runTransMultTests TransMultTests.cpp)
|
||||
target_link_libraries(runTransMultTests Parser ${Boost_LIBRARIES})
|
||||
add_test(NAME runTransMultTests WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${TEST_MEMCHECK_TOOL} ${EXECUTABLE_OUTPUT_PATH}/runTransMultTests )
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#include <stdexcept>
|
||||
#include <iostream>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#define BOOST_TEST_MODULE EclipseGridTests
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/TransMult.hpp>
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Empty) {
|
||||
Opm::TransMult transMult(10,10,10);
|
||||
|
||||
BOOST_CHECK_THROW( transMult.getMultiplier(12,10,10 , Opm::FaceDir::XPlus) , std::invalid_argument );
|
||||
BOOST_CHECK_THROW( transMult.getMultiplier(1000 , Opm::FaceDir::XPlus) , std::invalid_argument );
|
||||
|
||||
BOOST_CHECK_EQUAL( transMult.getMultiplier(9,9,9, Opm::FaceDir::YPlus) , 1.0 );
|
||||
BOOST_CHECK_EQUAL( transMult.getMultiplier(100 , Opm::FaceDir::ZPlus) , 1.0 );
|
||||
|
||||
BOOST_CHECK_EQUAL( transMult.getMultiplier(9,9,9, Opm::FaceDir::YMinus) , 1.0 );
|
||||
BOOST_CHECK_EQUAL( transMult.getMultiplier(100 , Opm::FaceDir::ZMinus) , 1.0 );
|
||||
}
|
||||
Reference in New Issue
Block a user