Integrated the MULTREGT in the EclipseState/TransMult

This commit is contained in:
Joakim Hove
2014-09-19 12:53:46 +02:00
parent 9c43c63d9e
commit fa335b50fb
11 changed files with 424 additions and 13 deletions

View File

@@ -24,6 +24,7 @@
#include <opm/parser/eclipse/EclipseState/Grid/BoxManager.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/MULTREGTScanner.hpp>
#include <iostream>
#include <sstream>
@@ -51,6 +52,7 @@ namespace Opm {
initProperties(deck);
initTransMult();
initFaults(deck);
initMULTREGT(deck);
}
std::shared_ptr<const UnitSystem> EclipseState::getDeckUnitSystem() const {
@@ -247,6 +249,7 @@ namespace Opm {
}
void EclipseState::setMULTFLT(std::shared_ptr<const Section> section) const {
for (size_t index=0; index < section->count("MULTFLT"); index++) {
DeckKeywordConstPtr faultsKeyword = section->getKeyword("MULTFLT" , index);
@@ -261,6 +264,33 @@ namespace Opm {
}
void EclipseState::initMULTREGT(DeckConstPtr deck) {
EclipseGridConstPtr grid = getEclipseGrid();
std::shared_ptr<MULTREGTScanner> scanner = std::make_shared<MULTREGTScanner>();
{
std::shared_ptr<Opm::GRIDSection> gridSection(new Opm::GRIDSection(deck) );
for (size_t index=0; index < gridSection->count("MULTREGT"); index++) {
DeckKeywordConstPtr multregtKeyword = gridSection->getKeyword("MULTREGT" , index);
scanner->addKeyword( multregtKeyword );
}
}
if (Section::hasEDIT(deck)) {
std::shared_ptr<Opm::EDITSection> editSection(new Opm::EDITSection(deck) );
for (size_t index=0; index < editSection->count("MULTREGT"); index++) {
DeckKeywordConstPtr multregtKeyword = editSection->getKeyword("MULTREGT" , index);
scanner->addKeyword( multregtKeyword );
}
}
m_transMult->applyMULTREGT( scanner , m_intGridProperties);
}
void EclipseState::initEclipseGrid(DeckConstPtr deck) {
m_eclipseGrid = EclipseGridConstPtr( new EclipseGrid( deck ));
}
@@ -384,9 +414,8 @@ namespace Opm {
SupportedIntKeywordInfo( "PVTNUM" , 1, "1" ),
SupportedIntKeywordInfo( "EQLNUM" , 1, "1" ),
SupportedIntKeywordInfo( "ENDNUM" , 1, "1" ),
// TODO: implement regular expression matching for
// keyword names?
// SupportedIntKeywordInfo( "FIP???" , 0 ),
SupportedIntKeywordInfo( "FLUXNUM" , 1 , "1" ),
SupportedIntKeywordInfo( "MULTNUM", 1 , "1" ),
SupportedIntKeywordInfo( "FIPNUM" , 1, "1" )};
double nan = std::numeric_limits<double>::quiet_NaN();

View File

@@ -168,6 +168,7 @@ namespace Opm {
void initRocktabTables(DeckConstPtr deck);
void setMULTFLT(std::shared_ptr<const Section> section) const;
void initMULTREGT(DeckConstPtr deck);
double getSIScaling(const std::string &dimensionString) const;

View File

@@ -124,4 +124,21 @@ namespace Opm {
}
}
void TransMult::applyMULTREGT( std::shared_ptr<MULTREGTScanner> multregtScanner , std::shared_ptr<GridProperties<int> > regions) {
const std::vector< MULTREGTConnection > connections = multregtScanner->scanRegions( regions );
for (auto iter = connections.begin(); iter != connections.end(); ++iter) {
MULTREGTConnection connection = *iter;
FaceDir::DirEnum faceDir = std::get<1>( connection );
std::shared_ptr<GridProperty<double> > multProperty = getDirectionProperty(faceDir);
{
size_t globalIndex = std::get<0>( connection );
double transMult = std::get<2>( connection );
multProperty->multiplyValueAtIndex( globalIndex , transMult);
}
}
}
}

View File

@@ -32,9 +32,13 @@
#include <cstddef>
#include <map>
#include <memory>
#include <opm/parser/eclipse/EclipseState/Grid/FaceDir.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/GridProperty.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/GridProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/FaultCollection.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/MULTREGTScanner.hpp>
namespace Opm {
@@ -48,6 +52,7 @@ namespace Opm {
std::shared_ptr<GridProperty<double> > getDirectionProperty(FaceDir::DirEnum faceDir);
void applyMULT(std::shared_ptr<const GridProperty<double> > srcMultProp, FaceDir::DirEnum faceDir);
void applyMULTFLT( std::shared_ptr<const FaultCollection> faults);
void applyMULTREGT( std::shared_ptr<MULTREGTScanner> multregtScanner , std::shared_ptr<GridProperties<int> > regions);
private:
size_t getGlobalIndex(size_t i , size_t j , size_t k) const;

View File

@@ -3,6 +3,11 @@ target_link_libraries(runEclipseGridTests Parser ${Boost_LIBRARIES})
add_test(NAME runEclipseGridTests WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${TEST_MEMCHECK_TOOL} ${EXECUTABLE_OUTPUT_PATH}/runEclipseGridTests )
add_executable(runMULTREGTScannerTests MULTREGTScannerTests.cpp)
target_link_libraries(runMULTREGTScannerTests Parser ${Boost_LIBRARIES})
add_test(NAME runMULTREGTScannerTests WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${TEST_MEMCHECK_TOOL} ${EXECUTABLE_OUTPUT_PATH}/runMULTREGTScannerTests )
add_executable(runGridPropertyTests GridPropertyTests.cpp)
target_link_libraries(runGridPropertyTests Parser ${Boost_LIBRARIES})
add_test(NAME runGridPropertyTests WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${TEST_MEMCHECK_TOOL} ${EXECUTABLE_OUTPUT_PATH}/runGridPropertyTests )

View File

@@ -106,9 +106,9 @@ static Opm::DeckPtr createInvalidMULTREGTDeck() {
BOOST_AUTO_TEST_CASE(InvalidInput) {
typedef Opm::GridProperties<int>::SupportedKeywordInfo SupportedKeywordInfo;
std::vector<SupportedKeywordInfo> supportedKeywords = { SupportedKeywordInfo("FLUXNUM" , 0) ,
SupportedKeywordInfo("OPERNUM" , 0) ,
SupportedKeywordInfo("MULTNUM" , 0) };
std::vector<SupportedKeywordInfo> supportedKeywords = { SupportedKeywordInfo("FLUXNUM" , 1 , "1") ,
SupportedKeywordInfo("OPERNUM" , 1 , "1") ,
SupportedKeywordInfo("MULTNUM" , 1 , "1") };
Opm::MULTREGTScanner scanner;
Opm::DeckPtr deck = createInvalidMULTREGTDeck();
@@ -243,9 +243,9 @@ static Opm::DeckPtr createSimpleMULTREGTDeck() {
BOOST_AUTO_TEST_CASE(SimpleMULTREGT) {
typedef Opm::GridProperties<int>::SupportedKeywordInfo SupportedKeywordInfo;
std::vector<SupportedKeywordInfo> supportedKeywords = { SupportedKeywordInfo("FLUXNUM" , 0) ,
SupportedKeywordInfo("OPERNUM" , 0) ,
SupportedKeywordInfo("MULTNUM" , 0) };
std::vector<SupportedKeywordInfo> supportedKeywords = { SupportedKeywordInfo("FLUXNUM" , 1 , "1") ,
SupportedKeywordInfo("OPERNUM" , 1 , "1") ,
SupportedKeywordInfo("MULTNUM" , 1 , "1") };
Opm::DeckPtr deck = createSimpleMULTREGTDeck();
Opm::EclipseGrid grid(deck);

View File

@@ -75,7 +75,7 @@ static DeckPtr createDeck() {
"\n"
"PROPS\n"
"REGIONS\n"
"FLUXNUM\n"
"SWAT\n"
"1000*1 /\n"
"SATNUM\n"
"1000*2 /\n"
@@ -170,9 +170,9 @@ BOOST_AUTO_TEST_CASE(IntProperties) {
BOOST_AUTO_TEST_CASE(PropertiesNotSupportedThrows) {
DeckPtr deck = createDeck();
EclipseState state(deck, /*beStrict=*/false);
DeckKeywordConstPtr fluxNUM = deck->getKeyword("FLUXNUM");
BOOST_CHECK_EQUAL( false , state.supportsGridProperty("FLUXNUM"));
BOOST_CHECK_THROW( state.loadGridPropertyFromDeckKeyword( std::make_shared<const Box>(10,10,10) , fluxNUM ) , std::invalid_argument)
DeckKeywordConstPtr swat = deck->getKeyword("SWAT");
BOOST_CHECK_EQUAL( false , state.supportsGridProperty("SWAT"));
BOOST_CHECK_THROW( state.loadGridPropertyFromDeckKeyword( std::make_shared<const Box>(10,10,10) , swat ) , std::invalid_argument)
}

View File

@@ -0,0 +1,43 @@
/*
Copyright 2013 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/>.
*/
#define BOOST_TEST_MODULE MULTREGT
#include <boost/test/unit_test.hpp>
#include <boost/test/test_tools.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParserRecord.hpp>
#include <opm/parser/eclipse/Parser/ParserIntItem.hpp>
#include <opm/parser/eclipse/Parser/ParserStringItem.hpp>
#include <opm/parser/eclipse/Parser/ParserEnums.hpp>
using namespace Opm;
BOOST_AUTO_TEST_CASE( parse_WCHONHIST_OK ) {
ParserPtr parser(new Parser());
boost::filesystem::path wconhistFile("testdata/integration_tests/WCONHIST/WCONHIST1");
DeckPtr deck = parser->parseFile(wconhistFile.string());
DeckKeywordConstPtr kw1 = deck->getKeyword("WCONHIST" , 0);
BOOST_CHECK_EQUAL( 3U , kw1->size() );

View File

@@ -0,0 +1,65 @@
/*
Copyright 2013 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/>.
*/
#define BOOST_TEST_MODULE ParseMULTREGT
#include <boost/test/unit_test.hpp>
#include <boost/test/test_tools.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParserRecord.hpp>
#include <opm/parser/eclipse/Parser/ParserIntItem.hpp>
#include <opm/parser/eclipse/Parser/ParserStringItem.hpp>
#include <opm/parser/eclipse/Parser/ParserEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/MULTREGTScanner.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/FaceDir.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
using namespace Opm;
BOOST_AUTO_TEST_CASE( parse_MULTREGT_OK ) {
ParserPtr parser(new Parser());
DeckPtr deck = parser->parseFile("testdata/integration_tests/MULTREGT/MULTREGT");
DeckKeywordConstPtr multregtKeyword = deck->getKeyword("MULTREGT" , 0);
BOOST_CHECK_NO_THROW( MULTREGTScanner::assertKeywordSupported( multregtKeyword ) );
}
BOOST_AUTO_TEST_CASE( MULTREGT_ECLIPSE_STATE ) {
ParserPtr parser(new Parser());
DeckPtr deck = parser->parseFile("testdata/integration_tests/MULTREGT/MULTREGT.DATA");
EclipseState state(deck);
auto transMult = state.getTransMult();
BOOST_CHECK_EQUAL( 0.10 , transMult->getMultiplier( 0 , 0 , 0 , FaceDir::XPlus ));
BOOST_CHECK_EQUAL( 0.10 , transMult->getMultiplier( 0 , 1 , 0 , FaceDir::XPlus ));
BOOST_CHECK_EQUAL( 0.20 , transMult->getMultiplier( 1 , 0 , 0 , FaceDir::XMinus ));
BOOST_CHECK_EQUAL( 0.20 , transMult->getMultiplier( 1 , 1 , 0 , FaceDir::XMinus ));
BOOST_CHECK_EQUAL( 1.50 , transMult->getMultiplier( 0 , 0 , 0 , FaceDir::ZPlus ));
BOOST_CHECK_EQUAL( 1.50 , transMult->getMultiplier( 0 , 1 , 0 , FaceDir::ZPlus ));
BOOST_CHECK_EQUAL( 1.00 , transMult->getMultiplier( 1 , 0 , 0 , FaceDir::ZPlus ));
BOOST_CHECK_EQUAL( 1.00 , transMult->getMultiplier( 1 , 1 , 0 , FaceDir::ZPlus ));
BOOST_CHECK_EQUAL( 0.60 , transMult->getMultiplier( 1 , 0 , 1 , FaceDir::ZMinus ));
BOOST_CHECK_EQUAL( 0.60 , transMult->getMultiplier( 1 , 1 , 1 , FaceDir::ZMinus ));
}