Integrated the MULTREGT in the EclipseState/TransMult
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user