TableManager and Deck are now used as references, hid GridProperties
* Added keyword "OPERNUM" to supported keywords in Eclipse3DProperties * Updated tests to use Eclipse3DProperties API instead of GridProperties * Moved init sequence of title into constructor * ThresholdPressure and SimulationConfig now tasks Deck ref instead of shared_ptr * Removed obsolete test and unused tests that tested gridProperties * Refactor use of TableManager. Is now a reference. * Added non-const GridProperties.getKeyword(size_t i)
This commit is contained in:
@@ -109,7 +109,8 @@ namespace Opm {
|
||||
GridProperties< int >::SupportedKeywordInfo( "FLUXNUM", 1, "1" ),
|
||||
GridProperties< int >::SupportedKeywordInfo( "MULTNUM", 1, "1" ),
|
||||
GridProperties< int >::SupportedKeywordInfo( "FIPNUM" , 1, "1" ),
|
||||
GridProperties< int >::SupportedKeywordInfo( "MISCNUM", 1, "1" )
|
||||
GridProperties< int >::SupportedKeywordInfo( "MISCNUM", 1, "1" ),
|
||||
GridProperties< int >::SupportedKeywordInfo( "OPERNUM" , 1, "1" ),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -309,14 +310,9 @@ namespace Opm {
|
||||
return supportedDoubleKeywords;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Eclipse3DProperties::Eclipse3DProperties( const Deck& deck,
|
||||
std::shared_ptr<const TableManager> tableManager,
|
||||
const EclipseGrid& eclipseGrid)
|
||||
const TableManager& tableManager,
|
||||
const EclipseGrid& eclipseGrid)
|
||||
:
|
||||
|
||||
m_defaultRegion("FLUXNUM"),
|
||||
@@ -326,9 +322,8 @@ namespace Opm {
|
||||
// register the grid properties
|
||||
m_intGridProperties(eclipseGrid, makeSupportedIntKeywords()),
|
||||
m_doubleGridProperties(eclipseGrid,
|
||||
makeSupportedDoubleKeywords(tableManager.get(), &eclipseGrid, &m_intGridProperties))
|
||||
makeSupportedDoubleKeywords(&tableManager, &eclipseGrid, &m_intGridProperties))
|
||||
{
|
||||
|
||||
/*
|
||||
* The EQUALREG, MULTREG, COPYREG, ... keywords are used to manipulate
|
||||
* vectors based on region values; for instance the statement
|
||||
@@ -369,7 +364,7 @@ namespace Opm {
|
||||
|
||||
|
||||
GridPropertyPostFunction< double > initPORV(&GridPropertyPostProcessor::initPORV,
|
||||
tableManager.get(),
|
||||
&tableManager,
|
||||
&eclipseGrid,
|
||||
&m_intGridProperties,
|
||||
&m_doubleGridProperties);
|
||||
@@ -417,15 +412,6 @@ namespace Opm {
|
||||
return m_doubleGridProperties.hasKeyword( keyword );
|
||||
}
|
||||
|
||||
GridProperties<int>& Eclipse3DProperties::getIntGridProperties() {
|
||||
return m_intGridProperties;
|
||||
}
|
||||
|
||||
/// gets properties doubleGridProperties. This does not run any post processors
|
||||
GridProperties<double>& Eclipse3DProperties::getDoubleGridProperties() {
|
||||
return m_doubleGridProperties;
|
||||
}
|
||||
|
||||
/*
|
||||
1. The public methods getIntGridProperty & getDoubleGridProperty will
|
||||
invoke and run the property post processor (if any is registered); the
|
||||
|
||||
@@ -56,16 +56,15 @@ namespace Opm {
|
||||
};
|
||||
|
||||
Eclipse3DProperties(const Deck& deck,
|
||||
std::shared_ptr<const TableManager> tableManager,
|
||||
const TableManager& tableManager,
|
||||
const EclipseGrid& eclipseGrid);
|
||||
|
||||
|
||||
const GridProperty<int>& getRegion(const DeckItem& regionItem) const;
|
||||
std::string getDefaultRegionKeyword() const;
|
||||
|
||||
const GridProperty<int>& getIntGridProperty ( const std::string& keyword ) const;
|
||||
const GridProperty<double>& getDoubleGridProperty ( const std::string& keyword ) const;
|
||||
GridProperties<int>& getIntGridProperties ();
|
||||
GridProperties<double>& getDoubleGridProperties();
|
||||
|
||||
bool hasDeckIntGridProperty(const std::string& keyword) const;
|
||||
bool hasDeckDoubleGridProperty(const std::string& keyword) const;
|
||||
@@ -100,10 +99,6 @@ namespace Opm {
|
||||
|
||||
static void setKeywordBox(const DeckKeyword& deckKeyword, const DeckRecord&, BoxManager& boxManager);
|
||||
|
||||
void initProperties( const Deck& deck,
|
||||
std::shared_ptr<const TableManager> tableManager,
|
||||
const EclipseGrid& eclipseGrid );
|
||||
|
||||
std::string m_defaultRegion;
|
||||
const UnitSystem& m_deckUnitSystem;
|
||||
GridProperties<int> m_intGridProperties;
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/FaultCollection.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/Fault.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/GridProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/MULTREGTScanner.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/SatfuncPropertyInitializers.hpp>
|
||||
@@ -51,20 +50,26 @@ namespace Opm {
|
||||
|
||||
EclipseState::EclipseState(std::shared_ptr<const Deck> deck, const ParseContext& parseContext) :
|
||||
m_deckUnitSystem( deck->getActiveUnitSystem() ),
|
||||
m_parseContext( parseContext),
|
||||
m_tables( std::make_shared<const TableManager>( *deck )),
|
||||
m_eclipseGrid( new EclipseGrid(deck)),
|
||||
m_parseContext( parseContext ),
|
||||
m_tables( *deck ),
|
||||
m_eclipseGrid( std::make_shared<EclipseGrid>(deck)),
|
||||
m_eclipseProperties( *deck, m_tables, *m_eclipseGrid)
|
||||
{
|
||||
initIOConfig(deck);
|
||||
|
||||
m_schedule = ScheduleConstPtr( new Schedule(m_parseContext , getEclipseGrid() , deck, m_ioConfig) );
|
||||
initIOConfigPostSchedule(deck);
|
||||
initTitle(deck);
|
||||
|
||||
if (deck->hasKeyword( "TITLE" )) {
|
||||
const auto& titleKeyword = deck->getKeyword( "TITLE" );
|
||||
const auto& item = titleKeyword.getRecord( 0 ).getItem( 0 );
|
||||
std::vector<std::string> itemValue = item.getData<std::string>();
|
||||
m_title = boost::algorithm::join( itemValue, " " );
|
||||
}
|
||||
|
||||
m_initConfig = std::make_shared<const InitConfig>(deck);
|
||||
m_simulationConfig = std::make_shared<const SimulationConfig>(m_parseContext, deck,
|
||||
m_eclipseProperties.getIntGridProperties() );
|
||||
m_simulationConfig = std::make_shared<const SimulationConfig>(m_parseContext, *deck,
|
||||
m_eclipseProperties);
|
||||
|
||||
initTransMult();
|
||||
initFaults(deck);
|
||||
@@ -98,7 +103,7 @@ namespace Opm {
|
||||
}
|
||||
|
||||
|
||||
std::shared_ptr<const TableManager> EclipseState::getTableManager() const {
|
||||
const TableManager& EclipseState::getTableManager() const {
|
||||
return m_tables;
|
||||
}
|
||||
|
||||
@@ -171,22 +176,22 @@ namespace Opm {
|
||||
void EclipseState::initTransMult() {
|
||||
EclipseGridConstPtr grid = getEclipseGrid();
|
||||
m_transMult = std::make_shared<TransMult>( grid->getNX() , grid->getNY() , grid->getNZ());
|
||||
// by obtaining doubleGridProperties we're circumventing the runpostprocessor which is called on state.getkeyword
|
||||
auto& doubleGp = m_eclipseProperties.getDoubleGridProperties();
|
||||
|
||||
const auto& p = m_eclipseProperties;
|
||||
if (m_eclipseProperties.hasDeckDoubleGridProperty("MULTX"))
|
||||
m_transMult->applyMULT(doubleGp.getKeyword("MULTX"), FaceDir::XPlus);
|
||||
m_transMult->applyMULT(p.getDoubleGridProperty("MULTX"), FaceDir::XPlus);
|
||||
if (m_eclipseProperties.hasDeckDoubleGridProperty("MULTX-"))
|
||||
m_transMult->applyMULT(doubleGp.getKeyword("MULTX-"), FaceDir::XMinus);
|
||||
m_transMult->applyMULT(p.getDoubleGridProperty("MULTX-"), FaceDir::XMinus);
|
||||
|
||||
if (m_eclipseProperties.hasDeckDoubleGridProperty("MULTY"))
|
||||
m_transMult->applyMULT(doubleGp.getKeyword("MULTY"), FaceDir::YPlus);
|
||||
m_transMult->applyMULT(p.getDoubleGridProperty("MULTY"), FaceDir::YPlus);
|
||||
if (m_eclipseProperties.hasDeckDoubleGridProperty("MULTY-"))
|
||||
m_transMult->applyMULT(doubleGp.getKeyword("MULTY-"), FaceDir::YMinus);
|
||||
m_transMult->applyMULT(p.getDoubleGridProperty("MULTY-"), FaceDir::YMinus);
|
||||
|
||||
if (m_eclipseProperties.hasDeckDoubleGridProperty("MULTZ"))
|
||||
m_transMult->applyMULT(doubleGp.getKeyword("MULTZ"), FaceDir::ZPlus);
|
||||
m_transMult->applyMULT(p.getDoubleGridProperty("MULTZ"), FaceDir::ZPlus);
|
||||
if (m_eclipseProperties.hasDeckDoubleGridProperty("MULTZ-"))
|
||||
m_transMult->applyMULT(doubleGp.getKeyword("MULTZ-"), FaceDir::ZMinus);
|
||||
m_transMult->applyMULT(p.getDoubleGridProperty("MULTZ-"), FaceDir::ZMinus);
|
||||
}
|
||||
|
||||
void EclipseState::initFaults(DeckConstPtr deck) {
|
||||
@@ -231,22 +236,13 @@ namespace Opm {
|
||||
|
||||
std::shared_ptr<MULTREGTScanner> scanner =
|
||||
std::make_shared<MULTREGTScanner>(
|
||||
m_eclipseProperties.getIntGridProperties(),
|
||||
m_eclipseProperties,
|
||||
multregtKeywords ,
|
||||
m_eclipseProperties.getDefaultRegionKeyword());
|
||||
|
||||
m_transMult->setMultregtScanner( scanner );
|
||||
}
|
||||
|
||||
void EclipseState::initTitle(DeckConstPtr deck) {
|
||||
if (deck->hasKeyword("TITLE")) {
|
||||
const auto& titleKeyword = deck->getKeyword("TITLE");
|
||||
const auto& item = titleKeyword.getRecord( 0 ).getItem( 0 );
|
||||
std::vector<std::string> itemValue = item.getData< std::string >();
|
||||
m_title = boost::algorithm::join(itemValue, " ");
|
||||
}
|
||||
}
|
||||
|
||||
void EclipseState::complainAboutAmbiguousKeyword(DeckConstPtr deck, const std::string& keywordName) const {
|
||||
OpmLog::addMessage(Log::MessageType::Error, "The " + keywordName + " keyword must be unique in the deck. Ignoring all!");
|
||||
auto keywords = deck->getKeywordList(keywordName);
|
||||
|
||||
@@ -24,8 +24,9 @@
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Eclipse3DProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp>
|
||||
#include <opm/parser/eclipse/Parser/MessageContainer.hpp>
|
||||
|
||||
namespace Opm {
|
||||
@@ -40,6 +41,7 @@ namespace Opm {
|
||||
class DeckKeyword;
|
||||
class DeckRecord;
|
||||
class EclipseGrid;
|
||||
class Eclipse3DProperties;
|
||||
class Fault;
|
||||
class FaultCollection;
|
||||
class InitConfig;
|
||||
@@ -52,6 +54,7 @@ namespace Opm {
|
||||
class TableManager;
|
||||
class TransMult;
|
||||
class UnitSystem;
|
||||
class MessageContainer;
|
||||
|
||||
class EclipseState {
|
||||
public:
|
||||
@@ -82,11 +85,12 @@ namespace Opm {
|
||||
bool hasNNC() const;
|
||||
|
||||
const Eclipse3DProperties& getEclipseProperties() const;
|
||||
std::shared_ptr<const TableManager> getTableManager() const;
|
||||
|
||||
// the unit system used by the deck. note that it is rarely needed to convert
|
||||
// units because internally to opm-parser everything is represented by SI
|
||||
// units...
|
||||
const TableManager& getTableManager() const;
|
||||
|
||||
// the unit system used by the deck. note that it is rarely needed to
|
||||
// convert units because internally to opm-parser everything is
|
||||
// represented by SI units...
|
||||
const UnitSystem& getDeckUnitSystem() const;
|
||||
void applyModifierDeck( std::shared_ptr<const Deck> deck);
|
||||
|
||||
@@ -94,28 +98,30 @@ namespace Opm {
|
||||
void initTabdims(std::shared_ptr< const Deck > deck);
|
||||
void initIOConfig(std::shared_ptr< const Deck > deck);
|
||||
void initIOConfigPostSchedule(std::shared_ptr< const Deck > deck);
|
||||
void initTitle(std::shared_ptr< const Deck > deck);
|
||||
void initTransMult();
|
||||
void initFaults(std::shared_ptr< const Deck > deck);
|
||||
|
||||
|
||||
void setMULTFLT(std::shared_ptr<const Opm::Section> section) const;
|
||||
void initMULTREGT(std::shared_ptr< const Deck > deck);
|
||||
|
||||
void complainAboutAmbiguousKeyword(std::shared_ptr< const Deck > deck, const std::string& keywordName) const;
|
||||
void complainAboutAmbiguousKeyword(std::shared_ptr< const Deck > deck,
|
||||
const std::string& keywordName) const;
|
||||
|
||||
std::shared_ptr< IOConfig > m_ioConfig;
|
||||
std::shared_ptr< const InitConfig > m_initConfig;
|
||||
std::shared_ptr< const Schedule > m_schedule;
|
||||
std::shared_ptr< const SimulationConfig > m_simulationConfig;
|
||||
|
||||
std::set<enum Phase::PhaseEnum> phases;
|
||||
std::string m_title;
|
||||
const UnitSystem& m_deckUnitSystem;
|
||||
std::shared_ptr<TransMult> m_transMult;
|
||||
std::shared_ptr<FaultCollection> m_faults;
|
||||
std::shared_ptr<NNC> m_nnc;
|
||||
|
||||
|
||||
const UnitSystem& m_deckUnitSystem;
|
||||
const ParseContext& m_parseContext;
|
||||
std::shared_ptr<const TableManager> m_tables;
|
||||
const TableManager m_tables;
|
||||
std::shared_ptr<const EclipseGrid> m_eclipseGrid;
|
||||
Eclipse3DProperties m_eclipseProperties;
|
||||
MessageContainer m_messageContainer;
|
||||
|
||||
@@ -28,9 +28,8 @@
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/GridProperty.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/GridProperties.hpp>
|
||||
|
||||
/**
|
||||
/*
|
||||
This class implements a container (std::unordered_map<std::string ,
|
||||
Gridproperty<T>>) of Gridproperties. Usage is as follows:
|
||||
|
||||
@@ -100,14 +99,16 @@ namespace Opm {
|
||||
throw std::invalid_argument("Invalid index");
|
||||
}
|
||||
|
||||
GridProperty<T>& getKeyword(size_t index) {
|
||||
GridProperty<T>& getKeyword(size_t index) {
|
||||
if (index < size())
|
||||
return *m_property_list[index];
|
||||
else
|
||||
throw std::invalid_argument("Invalid index");
|
||||
throw std::invalid_argument( "Invalid index" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const GridProperty<T>& getInitializedKeyword(const std::string& keyword) const {
|
||||
if (hasKeyword(keyword))
|
||||
return *m_properties.at( keyword );
|
||||
@@ -154,8 +155,8 @@ namespace Opm {
|
||||
void copyKeyword(const std::string& srcField ,
|
||||
const std::string& targetField ,
|
||||
const Box& inputBox) {
|
||||
auto& src = getKeyword( srcField );
|
||||
auto& target = getOrCreateProperty( targetField );
|
||||
const auto& src = this->getKeyword( srcField );
|
||||
auto& target = this->getOrCreateProperty( targetField );
|
||||
|
||||
target.copyFrom( src , inputBox );
|
||||
}
|
||||
|
||||
@@ -131,8 +131,6 @@ public:
|
||||
const std::string& getKeywordName() const;
|
||||
const SupportedKeywordInfo& getKeywordInfo() const;
|
||||
|
||||
void runPostProcessor();
|
||||
|
||||
ERT::EclKW<T> getEclKW() const;
|
||||
ERT::EclKW<T> getEclKW( const EclipseGrid & ) const;
|
||||
|
||||
@@ -147,6 +145,10 @@ private:
|
||||
const DeckItem& getDeckItem( const DeckKeyword& );
|
||||
void setDataPoint(size_t sourceIdx, size_t targetIdx, const DeckItem& deckItem);
|
||||
|
||||
void runPostProcessor();
|
||||
|
||||
friend class Eclipse3DProperties; // currently needed for runPostProcessor, see Eclipse3DProperties::getDoubleGridProperty
|
||||
|
||||
size_t m_nx, m_ny, m_nz;
|
||||
SupportedKeywordInfo m_kwInfo;
|
||||
std::vector<T> m_data;
|
||||
|
||||
@@ -40,9 +40,8 @@ template< typename T >
|
||||
size_t,
|
||||
const TableManager*,
|
||||
const EclipseGrid*,
|
||||
GridProperties<int>* ig_props,
|
||||
GridProperties<double>* dg_props
|
||||
);
|
||||
GridProperties<int>*,
|
||||
GridProperties<double>*);
|
||||
|
||||
GridPropertyInitFunction(
|
||||
signature,
|
||||
@@ -87,8 +86,8 @@ template< typename T >
|
||||
|
||||
private:
|
||||
signature f = nullptr;
|
||||
const TableManager* tm = nullptr;
|
||||
const EclipseGrid* eg = nullptr;
|
||||
const TableManager* tm = nullptr;
|
||||
const EclipseGrid* eg = nullptr;
|
||||
GridProperties<int>* igp = nullptr;
|
||||
GridProperties<double>* dgp = nullptr;
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Eclipse3DProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/FaceDir.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/GridProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/MULTREGTScanner.hpp>
|
||||
@@ -126,7 +127,7 @@ namespace Opm {
|
||||
Then it will go through the different regions and looking for
|
||||
interface with the wanted region values.
|
||||
*/
|
||||
MULTREGTScanner::MULTREGTScanner(const GridProperties<int>& cellRegionNumbers,
|
||||
MULTREGTScanner::MULTREGTScanner(const Eclipse3DProperties& cellRegionNumbers,
|
||||
const std::vector< const DeckKeyword* >& keywords,
|
||||
const std::string& defaultRegion ) :
|
||||
m_cellRegionNumbers(cellRegionNumbers) {
|
||||
@@ -136,7 +137,7 @@ namespace Opm {
|
||||
|
||||
MULTREGTSearchMap searchPairs;
|
||||
for (std::vector<MULTREGTRecord>::const_iterator record = m_records.begin(); record != m_records.end(); ++record) {
|
||||
if (cellRegionNumbers.hasKeyword( record->m_region.getValue())) {
|
||||
if (cellRegionNumbers.hasDeckIntGridProperty( record->m_region.getValue())) {
|
||||
if (record->m_srcRegion.hasValue() && record->m_targetRegion.hasValue()) {
|
||||
int srcRegion = record->m_srcRegion.getValue();
|
||||
int targetRegion = record->m_targetRegion.getValue();
|
||||
@@ -234,7 +235,7 @@ namespace Opm {
|
||||
double MULTREGTScanner::getRegionMultiplier(size_t globalIndex1 , size_t globalIndex2, FaceDir::DirEnum faceDir) const {
|
||||
|
||||
for (auto iter = m_searchMap.begin(); iter != m_searchMap.end(); iter++) {
|
||||
const Opm::GridProperty<int>& region = m_cellRegionNumbers.getKeyword( (*iter).first );
|
||||
const Opm::GridProperty<int>& region = m_cellRegionNumbers.getIntGridProperty( (*iter).first );
|
||||
MULTREGTSearchMap map = (*iter).second;
|
||||
|
||||
int regionId1 = region.iget(globalIndex1);
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#ifndef MULTREGTSCANNER_HPP
|
||||
#define MULTREGTSCANNER_HPP
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Eclipse3DProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/FaceDir.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Util/Value.hpp>
|
||||
|
||||
@@ -69,7 +70,7 @@ namespace Opm {
|
||||
class MULTREGTScanner {
|
||||
|
||||
public:
|
||||
MULTREGTScanner(const GridProperties<int>& cellRegionNumbers,
|
||||
MULTREGTScanner(const Eclipse3DProperties& cellRegionNumbers,
|
||||
const std::vector< const DeckKeyword* >& keywords,
|
||||
const std::string& defaultRegion);
|
||||
double getRegionMultiplier(size_t globalCellIdx1, size_t globalCellIdx2, FaceDir::DirEnum faceDir) const;
|
||||
@@ -79,7 +80,7 @@ namespace Opm {
|
||||
void assertKeywordSupported(const DeckKeyword& deckKeyword, const std::string& defaultRegion);
|
||||
std::vector< MULTREGTRecord > m_records;
|
||||
std::map<std::string , MULTREGTSearchMap> m_searchMap;
|
||||
const GridProperties<int>& m_cellRegionNumbers;
|
||||
const Eclipse3DProperties& m_cellRegionNumbers;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -157,24 +157,23 @@ BOOST_AUTO_TEST_CASE(SetFromDeckKeyword) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(copy) {
|
||||
typedef Opm::GridProperty<int>::SupportedKeywordInfo SupportedKeywordInfo;
|
||||
SupportedKeywordInfo keywordInfo1("P1" , 0, "1");
|
||||
SupportedKeywordInfo keywordInfo2("P2" , 9, "1");
|
||||
Opm::GridProperty<int> prop1( 4 , 4 , 2 , keywordInfo1);
|
||||
Opm::GridProperty<int> prop2( 4 , 4 , 2 , keywordInfo2);
|
||||
SupportedKeywordInfo keywordInfo1("P1", 0, "1");
|
||||
SupportedKeywordInfo keywordInfo2("P2", 9, "1");
|
||||
Opm::GridProperty<int> prop1(4, 4, 2, keywordInfo1);
|
||||
Opm::GridProperty<int> prop2(4, 4, 2, keywordInfo2);
|
||||
|
||||
Opm::Box global(4,4,2);
|
||||
Opm::Box layer0(global , 0,3,0,3,0,0);
|
||||
Opm::Box global(4, 4, 2);
|
||||
Opm::Box layer0(global, 0, 3, 0, 3, 0, 0);
|
||||
|
||||
prop2.copyFrom(prop1 , layer0);
|
||||
prop2.copyFrom(prop1, layer0);
|
||||
|
||||
for (size_t j=0; j < 4; j++) {
|
||||
for (size_t i=0; i < 4; i++) {
|
||||
for (size_t j = 0; j < 4; j++) {
|
||||
for (size_t i = 0; i < 4; i++) {
|
||||
|
||||
BOOST_CHECK_EQUAL( prop2.iget(i,j,0), 0 );
|
||||
BOOST_CHECK_EQUAL( prop2.iget(i,j,1), 9 );
|
||||
BOOST_CHECK_EQUAL(prop2.iget(i, j, 0), 0);
|
||||
BOOST_CHECK_EQUAL(prop2.iget(i, j, 1), 9);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -363,6 +362,9 @@ BOOST_AUTO_TEST_CASE(GridPropertyInitialization) {
|
||||
|
||||
// make sure that EclipseState does not throw if it is asked for a supported
|
||||
// grid property that is not contained in the deck
|
||||
BOOST_CHECK_NO_THROW(props.hasDeckDoubleGridProperty("ISWU"));
|
||||
BOOST_CHECK_NO_THROW(props.hasDeckIntGridProperty("FLUXNUM"));
|
||||
|
||||
BOOST_CHECK(!props.hasDeckDoubleGridProperty("ISWU"));
|
||||
BOOST_CHECK(!props.hasDeckIntGridProperty("FLUXNUM"));
|
||||
|
||||
@@ -397,80 +399,6 @@ void TestPostProcessorMul(std::vector< double >& values,
|
||||
}
|
||||
|
||||
|
||||
|
||||
static Opm::DeckPtr createDeck() {
|
||||
const char *deckData =
|
||||
"RUNSPEC\n"
|
||||
"\n"
|
||||
"DIMENS\n"
|
||||
" 10 10 10 /\n"
|
||||
"GRID\n"
|
||||
"DX\n"
|
||||
"1000*0.25 /\n"
|
||||
"DYV\n"
|
||||
"10*0.25 /\n"
|
||||
"DZ\n"
|
||||
"1000*0.25 /\n"
|
||||
"TOPS\n"
|
||||
"100*0.25 /\n"
|
||||
"MULTPV \n"
|
||||
"1000*0.10 / \n"
|
||||
"PORO \n"
|
||||
"1000*0.10 / \n"
|
||||
"EDIT\n"
|
||||
"\n";
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
return parser->parseString(deckData, Opm::ParseContext()) ;
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(GridPropertyPostProcessors) {
|
||||
typedef Opm::GridPropertySupportedKeywordInfo<double> SupportedKeywordInfo;
|
||||
|
||||
Opm::DeckPtr deck = createDeck();
|
||||
Opm::EclipseGrid grid(deck);
|
||||
std::shared_ptr<Opm::TableManager> tm = std::make_shared<Opm::TableManager>(*deck);
|
||||
Opm::Eclipse3DProperties props(*deck, tm, grid);
|
||||
|
||||
SupportedKeywordInfo kwInfo1("MULTPV" , 1.0 , "1");
|
||||
Opm::GridPropertyPostFunction< double > gfunc( &TestPostProcessorMul,
|
||||
tm.get(),
|
||||
&grid,
|
||||
&props.getIntGridProperties(),
|
||||
&props.getDoubleGridProperties() );
|
||||
|
||||
SupportedKeywordInfo kwInfo2("PORO", 1.0, gfunc, "1");
|
||||
std::vector<SupportedKeywordInfo > supportedKeywords = { kwInfo1, kwInfo2 };
|
||||
|
||||
Opm::GridProperties<double> properties(grid, std::move( supportedKeywords ) );
|
||||
|
||||
{
|
||||
auto& poro = properties.getKeyword("PORO");
|
||||
auto& multpv = properties.getKeyword("MULTPV");
|
||||
|
||||
poro.loadFromDeckKeyword( deck->getKeyword("PORO" , 0));
|
||||
multpv.loadFromDeckKeyword( deck->getKeyword("MULTPV" , 0));
|
||||
|
||||
poro.runPostProcessor();
|
||||
multpv.runPostProcessor();
|
||||
|
||||
for (size_t g = 0; g < 1000; g++) {
|
||||
BOOST_CHECK_EQUAL( multpv.iget(g) , 0.10 );
|
||||
BOOST_CHECK_EQUAL( poro.iget(g) , 0.20 );
|
||||
}
|
||||
|
||||
poro.runPostProcessor();
|
||||
multpv.runPostProcessor();
|
||||
|
||||
for (size_t g = 0; g < 1000; g++) {
|
||||
BOOST_CHECK_EQUAL( multpv.iget(g) , 0.10 );
|
||||
BOOST_CHECK_EQUAL( poro.iget(g) , 0.20 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(multiply) {
|
||||
typedef Opm::GridProperty<int>::SupportedKeywordInfo SupportedKeywordInfo;
|
||||
SupportedKeywordInfo keywordInfo("P" , 10 , "1");
|
||||
|
||||
@@ -98,38 +98,28 @@ static Opm::DeckPtr createInvalidMULTREGTDeck() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(InvalidInput) {
|
||||
typedef Opm::GridProperties<int>::SupportedKeywordInfo SupportedKeywordInfo;
|
||||
std::vector<SupportedKeywordInfo> supportedKeywords = {
|
||||
SupportedKeywordInfo("FLUXNUM" , 1 , "1") ,
|
||||
SupportedKeywordInfo("OPERNUM" , 1 , "1") ,
|
||||
SupportedKeywordInfo("MULTNUM" , 1 , "1")
|
||||
};
|
||||
|
||||
|
||||
Opm::DeckPtr deck = createInvalidMULTREGTDeck();
|
||||
Opm::EclipseGrid grid( deck );
|
||||
Opm::GridProperties<int> gridProperties( grid, std::move( supportedKeywords ) );
|
||||
Opm::Eclipse3DProperties ep( *deck, Opm::TableManager( *deck ), grid );
|
||||
|
||||
// Invalid direction
|
||||
std::vector< const Opm::DeckKeyword* > keywords0;
|
||||
const auto& multregtKeyword0 = deck->getKeyword("MULTREGT",0);
|
||||
std::vector<const Opm::DeckKeyword*> keywords0;
|
||||
const auto& multregtKeyword0 = deck->getKeyword( "MULTREGT", 0 );
|
||||
keywords0.push_back( &multregtKeyword0 );
|
||||
BOOST_CHECK_THROW( Opm::MULTREGTScanner scanner(gridProperties, keywords0, "MULTNUM"); , std::invalid_argument);
|
||||
BOOST_CHECK_THROW( Opm::MULTREGTScanner scanner( ep, keywords0, "MULTNUM" ); , std::invalid_argument );
|
||||
|
||||
// Not supported region
|
||||
std::vector<const Opm::DeckKeyword*> keywords1;
|
||||
const auto& multregtKeyword1 = deck->getKeyword( "MULTREGT", 1 );
|
||||
keywords1.push_back( &multregtKeyword1 );
|
||||
BOOST_CHECK_THROW( Opm::MULTREGTScanner scanner( gridProperties, keywords1, "MULTNUM" ); , std::invalid_argument );
|
||||
BOOST_CHECK_THROW( Opm::MULTREGTScanner scanner( ep, keywords1, "MULTNUM" ); , std::invalid_argument );
|
||||
|
||||
// The keyword is ok; but it refers to a region which is not in the deck.
|
||||
std::vector< const Opm::DeckKeyword* > keywords2;
|
||||
const auto& multregtKeyword2 = deck->getKeyword( "MULTREGT",2);
|
||||
std::vector<const Opm::DeckKeyword*> keywords2;
|
||||
const auto& multregtKeyword2 = deck->getKeyword( "MULTREGT", 2 );
|
||||
keywords2.push_back( &multregtKeyword2 );
|
||||
BOOST_CHECK_THROW( Opm::MULTREGTScanner scanner(gridProperties,keywords2,"MULTNUM"); , std::logic_error);
|
||||
BOOST_CHECK_THROW( Opm::MULTREGTScanner scanner( ep, keywords2, "MULTNUM" ); , std::logic_error );
|
||||
}
|
||||
|
||||
|
||||
@@ -168,41 +158,37 @@ static Opm::DeckPtr createNotSupportedMULTREGTDeck() {
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(NotSupported) {
|
||||
typedef Opm::GridProperties<int>::SupportedKeywordInfo SupportedKeywordInfo;
|
||||
std::vector<SupportedKeywordInfo> supportedKeywords = {
|
||||
SupportedKeywordInfo("FLUXNUM" , 1 , "1") ,
|
||||
SupportedKeywordInfo("OPERNUM" , 1 , "1") ,
|
||||
SupportedKeywordInfo("MULTNUM" , 1 , "1")
|
||||
};
|
||||
Opm::DeckPtr deck = createNotSupportedMULTREGTDeck();
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(NotSupported) {
|
||||
Opm::DeckPtr deck = createNotSupportedMULTREGTDeck();
|
||||
Opm::EclipseGrid grid( deck );
|
||||
Opm::GridProperties<int> gridProperties( grid, std::move( supportedKeywords ) );
|
||||
Opm::Eclipse3DProperties ep( *deck, Opm::TableManager( *deck ), grid );
|
||||
|
||||
// Not support NOAQUNNC behaviour
|
||||
std::vector< const Opm::DeckKeyword* > keywords0;
|
||||
const auto& multregtKeyword0 = deck->getKeyword("MULTREGT",0);
|
||||
std::vector<const Opm::DeckKeyword*> keywords0;
|
||||
const auto& multregtKeyword0 = deck->getKeyword( "MULTREGT", 0 );
|
||||
keywords0.push_back( &multregtKeyword0 );
|
||||
BOOST_CHECK_THROW( Opm::MULTREGTScanner scanner(gridProperties,keywords0,"MULTNUM"); , std::invalid_argument);
|
||||
BOOST_CHECK_THROW( Opm::MULTREGTScanner scanner( ep, keywords0, "MULTNUM" ); , std::invalid_argument );
|
||||
|
||||
// Defaulted from value - not supported
|
||||
std::vector< const Opm::DeckKeyword* > keywords1;
|
||||
const auto& multregtKeyword1 = deck->getKeyword("MULTREGT",1);
|
||||
std::vector<const Opm::DeckKeyword*> keywords1;
|
||||
const auto& multregtKeyword1 = deck->getKeyword( "MULTREGT", 1 );
|
||||
keywords1.push_back( &multregtKeyword1 );
|
||||
BOOST_CHECK_THROW( Opm::MULTREGTScanner scanner(gridProperties,keywords1,"MULTNUM"); , std::invalid_argument);
|
||||
BOOST_CHECK_THROW( Opm::MULTREGTScanner scanner( ep, keywords1, "MULTNUM" ); , std::invalid_argument );
|
||||
|
||||
|
||||
// Defaulted to value - not supported
|
||||
std::vector< const Opm::DeckKeyword* > keywords2;
|
||||
const auto& multregtKeyword2 = deck->getKeyword("MULTREGT",2);
|
||||
std::vector<const Opm::DeckKeyword*> keywords2;
|
||||
const auto& multregtKeyword2 = deck->getKeyword( "MULTREGT", 2 );
|
||||
keywords2.push_back( &multregtKeyword2 );
|
||||
BOOST_CHECK_THROW( Opm::MULTREGTScanner scanner(gridProperties,keywords2,"MULTNUM"); , std::invalid_argument);
|
||||
BOOST_CHECK_THROW( Opm::MULTREGTScanner scanner( ep, keywords2, "MULTNUM" ); , std::invalid_argument );
|
||||
|
||||
// srcValue == targetValue - not supported
|
||||
std::vector< const Opm::DeckKeyword* > keywords3;
|
||||
const Opm::DeckKeyword& multregtKeyword3 = deck->getKeyword("MULTREGT",3);
|
||||
std::vector<const Opm::DeckKeyword*> keywords3;
|
||||
const Opm::DeckKeyword& multregtKeyword3 = deck->getKeyword( "MULTREGT", 3 );
|
||||
keywords3.push_back( &multregtKeyword3 );
|
||||
BOOST_CHECK_THROW( Opm::MULTREGTScanner scanner(gridProperties,keywords3 , "MULTNUM"); , std::invalid_argument);
|
||||
BOOST_CHECK_THROW( Opm::MULTREGTScanner scanner( ep, keywords3, "MULTNUM" ); , std::invalid_argument );
|
||||
}
|
||||
|
||||
static Opm::DeckPtr createCopyMULTNUMDeck() {
|
||||
@@ -231,8 +217,6 @@ static Opm::DeckPtr createCopyMULTNUMDeck() {
|
||||
return parser->parseString(deckData, Opm::ParseContext()) ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(MULTREGT_COPY_MULTNUM) {
|
||||
Opm::DeckPtr deck = createCopyMULTNUMDeck();
|
||||
Opm::EclipseState state(deck , Opm::ParseContext());
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Section.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Eclipse3DProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords/C.hpp>
|
||||
@@ -46,14 +47,14 @@
|
||||
namespace Opm {
|
||||
|
||||
SimulationConfig::SimulationConfig(const ParseContext& parseContext,
|
||||
DeckConstPtr deck,
|
||||
GridProperties<int>& gridProperties) :
|
||||
const Deck& deck,
|
||||
const Eclipse3DProperties& eclipseProperties) :
|
||||
m_useCPR(false),
|
||||
m_DISGAS(false),
|
||||
m_VAPOIL(false)
|
||||
{
|
||||
if (Section::hasRUNSPEC(*deck)) {
|
||||
const RUNSPECSection runspec(*deck);
|
||||
if (Section::hasRUNSPEC(deck)) {
|
||||
const RUNSPECSection runspec(deck);
|
||||
if (runspec.hasKeyword<ParserKeywords::CPR>()) {
|
||||
const auto& cpr = runspec.getKeyword<ParserKeywords::CPR>();
|
||||
if (cpr.size() > 0)
|
||||
@@ -69,14 +70,14 @@ namespace Opm {
|
||||
}
|
||||
}
|
||||
|
||||
initThresholdPressure(parseContext , deck, gridProperties);
|
||||
initThresholdPressure(parseContext , deck, eclipseProperties);
|
||||
}
|
||||
|
||||
|
||||
void SimulationConfig::initThresholdPressure(const ParseContext& parseContext,
|
||||
DeckConstPtr deck,
|
||||
GridProperties<int>& gridProperties) {
|
||||
m_ThresholdPressure = std::make_shared<const ThresholdPressure>(parseContext , deck, gridProperties);
|
||||
const Deck& deck,
|
||||
const Eclipse3DProperties& eclipseProperties) {
|
||||
m_ThresholdPressure = std::make_shared<const ThresholdPressure>(parseContext , deck, eclipseProperties);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -21,11 +21,10 @@
|
||||
#define OPM_SIMULATION_CONFIG_HPP
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Eclipse3DProperties.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
template< typename > class GridProperties;
|
||||
|
||||
class ThresholdPressure;
|
||||
class ParseContext;
|
||||
|
||||
@@ -34,8 +33,8 @@ namespace Opm {
|
||||
public:
|
||||
|
||||
SimulationConfig(const ParseContext& parseContext,
|
||||
DeckConstPtr deck,
|
||||
GridProperties<int>& gridProperties);
|
||||
const Deck& deck,
|
||||
const Eclipse3DProperties& gridProperties);
|
||||
|
||||
std::shared_ptr<const ThresholdPressure> getThresholdPressure() const;
|
||||
bool hasThresholdPressure() const;
|
||||
@@ -46,8 +45,8 @@ namespace Opm {
|
||||
private:
|
||||
|
||||
void initThresholdPressure(const ParseContext& parseContext,
|
||||
DeckConstPtr deck,
|
||||
GridProperties<int>& gridProperties);
|
||||
const Deck& deck,
|
||||
const Eclipse3DProperties& gridProperties);
|
||||
|
||||
std::shared_ptr< const ThresholdPressure > m_ThresholdPressure;
|
||||
bool m_useCPR;
|
||||
|
||||
@@ -16,9 +16,10 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Section.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/GridProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Eclipse3DProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp>
|
||||
#include <opm/common/OpmLog/OpmLog.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
@@ -29,15 +30,16 @@
|
||||
|
||||
namespace Opm {
|
||||
|
||||
ThresholdPressure::ThresholdPressure(const ParseContext& parseContext, DeckConstPtr deck,
|
||||
GridProperties<int>& gridProperties)
|
||||
: m_parseContext( parseContext )
|
||||
ThresholdPressure::ThresholdPressure(const ParseContext& parseContext,
|
||||
const Deck& deck,
|
||||
const Eclipse3DProperties& eclipseProperties) :
|
||||
m_parseContext( parseContext )
|
||||
{
|
||||
|
||||
if (Section::hasRUNSPEC(*deck) && Section::hasSOLUTION(*deck)) {
|
||||
std::shared_ptr<const RUNSPECSection> runspecSection = std::make_shared<const RUNSPECSection>(*deck);
|
||||
std::shared_ptr<const SOLUTIONSection> solutionSection = std::make_shared<const SOLUTIONSection>(*deck);
|
||||
initThresholdPressure(parseContext, runspecSection, solutionSection, gridProperties);
|
||||
if (Section::hasRUNSPEC( deck ) && Section::hasSOLUTION( deck )) {
|
||||
std::shared_ptr<const RUNSPECSection> runspecSection = std::make_shared<const RUNSPECSection>( deck );
|
||||
std::shared_ptr<const SOLUTIONSection> solutionSection = std::make_shared<const SOLUTIONSection>( deck );
|
||||
initThresholdPressure( parseContext, runspecSection, solutionSection, eclipseProperties );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,11 +70,11 @@ namespace Opm {
|
||||
void ThresholdPressure::initThresholdPressure(const ParseContext& /* parseContext */,
|
||||
std::shared_ptr<const RUNSPECSection> runspecSection,
|
||||
std::shared_ptr<const SOLUTIONSection> solutionSection,
|
||||
GridProperties<int>& gridProperties) {
|
||||
const Eclipse3DProperties& eclipseProperties) {
|
||||
|
||||
bool thpresOption = false;
|
||||
const bool thpresKeyword = solutionSection->hasKeyword<ParserKeywords::THPRES>( );
|
||||
const bool hasEqlnumKeyword = gridProperties.hasKeyword<ParserKeywords::EQLNUM>( );
|
||||
const bool hasEqlnumKeyword = eclipseProperties.hasDeckIntGridProperty( "EQLNUM" );
|
||||
int maxEqlnum = 0;
|
||||
|
||||
//Is THPRES option set?
|
||||
@@ -96,7 +98,7 @@ namespace Opm {
|
||||
{
|
||||
//Find max of eqlnum
|
||||
if (hasEqlnumKeyword) {
|
||||
const auto& eqlnumKeyword = gridProperties.getKeyword<ParserKeywords::EQLNUM>( );
|
||||
const auto& eqlnumKeyword = eclipseProperties.getIntGridProperty( "EQLNUM" );
|
||||
const auto& eqlnum = eqlnumKeyword.getData();
|
||||
maxEqlnum = *std::max_element(eqlnum.begin(), eqlnum.end());
|
||||
|
||||
@@ -190,8 +192,3 @@ namespace Opm {
|
||||
|
||||
|
||||
} //namespace Opm
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -23,9 +23,10 @@
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Eclipse3DProperties.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
template< typename > class GridProperties;
|
||||
|
||||
class Deck;
|
||||
class ParseContext;
|
||||
@@ -37,8 +38,8 @@ namespace Opm {
|
||||
public:
|
||||
|
||||
ThresholdPressure(const ParseContext& parseContext,
|
||||
std::shared_ptr< const Deck > deck,
|
||||
GridProperties<int>& gridProperties);
|
||||
const Deck& deck,
|
||||
const Eclipse3DProperties& eclipseProperties);
|
||||
|
||||
|
||||
/*
|
||||
@@ -71,7 +72,7 @@ namespace Opm {
|
||||
void initThresholdPressure(const ParseContext& parseContext,
|
||||
std::shared_ptr<const RUNSPECSection> runspecSection,
|
||||
std::shared_ptr<const SOLUTIONSection> solutionSection,
|
||||
GridProperties<int>& gridProperties);
|
||||
const Eclipse3DProperties& eclipseProperties);
|
||||
|
||||
static std::pair<int,int> makeIndex(int r1 , int r2);
|
||||
void addPair(int r1 , int r2 , const std::pair<bool , double>& valuePair);
|
||||
|
||||
@@ -110,70 +110,60 @@ static DeckPtr createDeck(const ParseContext& parseContext , const std::string&
|
||||
return parser.parseString(input, parseContext);
|
||||
}
|
||||
|
||||
static GridProperties<int> getGridProperties() {
|
||||
GridPropertySupportedKeywordInfo<int> kwInfo = GridPropertySupportedKeywordInfo<int>("EQLNUM", 3, "");
|
||||
std::vector<GridPropertySupportedKeywordInfo<int>> supportedKeywordsVec;
|
||||
supportedKeywordsVec.push_back(kwInfo);
|
||||
const EclipseGrid eclipseGrid(3, 3, 3);
|
||||
GridProperties<int> gridProperties(eclipseGrid, std::move(supportedKeywordsVec));
|
||||
gridProperties.addKeyword("EQLNUM");
|
||||
return gridProperties;
|
||||
static Eclipse3DProperties getGridProperties(DeckPtr deck) {
|
||||
return Eclipse3DProperties( *deck, TableManager( *deck ), EclipseGrid( 10, 3, 4 ) );
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(SimulationConfigGetThresholdPressureTableTest) {
|
||||
ParseContext parseContext;
|
||||
auto gp = getGridProperties();
|
||||
DeckPtr deck = createDeck(parseContext, inputStr);
|
||||
DeckPtr deck = createDeck(parseContext , inputStr);
|
||||
SimulationConfigConstPtr simulationConfigPtr;
|
||||
BOOST_CHECK_NO_THROW( simulationConfigPtr = std::make_shared<const SimulationConfig>( parseContext, deck, gp ) );
|
||||
BOOST_CHECK_NO_THROW(simulationConfigPtr = std::make_shared
|
||||
<const SimulationConfig>(parseContext , *deck, getGridProperties(deck)));
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(SimulationConfigNOTHPRES) {
|
||||
ParseContext parseContext;
|
||||
auto gp = getGridProperties();
|
||||
DeckPtr deck = createDeck(parseContext , inputStr_noTHPRES);
|
||||
SimulationConfig simulationConfig(parseContext , deck, gp);
|
||||
BOOST_CHECK_EQUAL( false , simulationConfig.hasThresholdPressure());
|
||||
SimulationConfig simulationConfig(parseContext , *deck, getGridProperties(deck));
|
||||
BOOST_CHECK( !simulationConfig.hasThresholdPressure() );
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(SimulationConfigCPRNotUsed) {
|
||||
ParseContext parseContext;
|
||||
auto gp = getGridProperties();
|
||||
DeckPtr deck = createDeck(parseContext , inputStr_noTHPRES);
|
||||
SimulationConfig simulationConfig(parseContext , deck, gp);
|
||||
BOOST_CHECK_EQUAL( false , simulationConfig.useCPR());
|
||||
ParseContext parseContext;
|
||||
DeckPtr deck = createDeck(parseContext , inputStr_noTHPRES);
|
||||
SimulationConfig simulationConfig(parseContext , *deck, getGridProperties(deck));
|
||||
BOOST_CHECK( ! simulationConfig.useCPR());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(SimulationConfigCPRUsed) {
|
||||
ParseContext parseContext;
|
||||
auto gp = getGridProperties();
|
||||
DeckPtr deck = createDeck(parseContext , inputStr_cpr);
|
||||
SUMMARYSection summary(*deck);
|
||||
SimulationConfig simulationConfig(parseContext , deck, gp);
|
||||
BOOST_CHECK_EQUAL( true , simulationConfig.useCPR());
|
||||
BOOST_CHECK_EQUAL( false , summary.hasKeyword("CPR"));
|
||||
ParseContext parseContext;
|
||||
DeckPtr deck = createDeck(parseContext , inputStr_cpr);
|
||||
SUMMARYSection summary(*deck);
|
||||
SimulationConfig simulationConfig(parseContext , *deck, getGridProperties(deck));
|
||||
BOOST_CHECK( simulationConfig.useCPR() );
|
||||
BOOST_CHECK( ! summary.hasKeyword("CPR") );
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(SimulationConfigCPRInSUMMARYSection) {
|
||||
ParseContext parseContext;
|
||||
auto gp = getGridProperties();
|
||||
DeckPtr deck = createDeck(parseContext , inputStr_cpr_in_SUMMARY);
|
||||
SUMMARYSection summary(*deck);
|
||||
SimulationConfig simulationConfig(parseContext , deck, gp);
|
||||
BOOST_CHECK_EQUAL( false , simulationConfig.useCPR());
|
||||
BOOST_CHECK_EQUAL( true , summary.hasKeyword("CPR"));
|
||||
SimulationConfig simulationConfig(parseContext , *deck, getGridProperties(deck));
|
||||
BOOST_CHECK( ! simulationConfig.useCPR());
|
||||
BOOST_CHECK( summary.hasKeyword("CPR"));
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(SimulationConfigCPRBoth) {
|
||||
ParseContext parseContext;
|
||||
auto gp = getGridProperties();
|
||||
DeckPtr deck = createDeck(parseContext , inputStr_cpr_BOTH);
|
||||
SUMMARYSection summary(*deck);
|
||||
SimulationConfig simulationConfig(parseContext , deck, gp);
|
||||
BOOST_CHECK_EQUAL( true , simulationConfig.useCPR());
|
||||
BOOST_CHECK_EQUAL( true , summary.hasKeyword("CPR"));
|
||||
SimulationConfig simulationConfig(parseContext , *deck, getGridProperties(deck));
|
||||
BOOST_CHECK( simulationConfig.useCPR());
|
||||
BOOST_CHECK( summary.hasKeyword("CPR"));
|
||||
|
||||
const auto& cpr = summary.getKeyword<ParserKeywords::CPR>();
|
||||
const auto& record = cpr.getRecord(0);
|
||||
@@ -193,15 +183,13 @@ BOOST_AUTO_TEST_CASE(SimulationConfigCPRRUnspecWithData) {
|
||||
|
||||
BOOST_AUTO_TEST_CASE(SimulationConfig_VAPOIL_DISGAS) {
|
||||
ParseContext parseContext;
|
||||
auto gp1 = getGridProperties();
|
||||
DeckPtr deck = createDeck(parseContext , inputStr);
|
||||
SimulationConfig simulationConfig(parseContext , deck, gp1);
|
||||
SimulationConfig simulationConfig(parseContext , *deck, getGridProperties(deck));
|
||||
BOOST_CHECK_EQUAL( false , simulationConfig.hasDISGAS());
|
||||
BOOST_CHECK_EQUAL( false , simulationConfig.hasVAPOIL());
|
||||
|
||||
auto gp2 = getGridProperties();
|
||||
DeckPtr deck_vd = createDeck(parseContext, inputStr_vap_dis);
|
||||
SimulationConfig simulationConfig_vd(parseContext , deck_vd, gp2);
|
||||
SimulationConfig simulationConfig_vd(parseContext , *deck_vd, getGridProperties(deck_vd));
|
||||
BOOST_CHECK_EQUAL( true , simulationConfig_vd.hasDISGAS());
|
||||
BOOST_CHECK_EQUAL( true , simulationConfig_vd.hasVAPOIL());
|
||||
}
|
||||
|
||||
@@ -29,7 +29,10 @@
|
||||
#include <opm/common/utility/platform_dependent/reenable_warnings.h>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Eclipse3DProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
|
||||
@@ -53,6 +56,42 @@ const std::string& inputStr = "RUNSPEC\n"
|
||||
"/\n"
|
||||
"\n";
|
||||
|
||||
const std::string& inputStrWithEqlNum =
|
||||
"RUNSPEC\n"
|
||||
"EQLOPTS\n"
|
||||
"THPRES /\n "
|
||||
"\n"
|
||||
"REGIONS\n"
|
||||
"EQLNUM\n"
|
||||
" 27*3 /\n"
|
||||
"SOLUTION\n"
|
||||
"THPRES\n"
|
||||
"1 2 12.0/\n"
|
||||
"1 3 5.0/\n"
|
||||
"2 3 33.0 /\n"
|
||||
"2 3 7.0/\n"
|
||||
"/\n"
|
||||
"\n";
|
||||
|
||||
|
||||
const std::string& inputStrWithEqlNumall0 =
|
||||
"RUNSPEC\n"
|
||||
"EQLOPTS\n"
|
||||
"THPRES /\n "
|
||||
"\n"
|
||||
"REGIONS\n"
|
||||
"EQLNUM\n"
|
||||
" 27*0 /\n"
|
||||
"SOLUTION\n"
|
||||
"THPRES\n"
|
||||
"1 2 12.0/\n"
|
||||
"1 3 5.0/\n"
|
||||
"2 3 33.0 /\n"
|
||||
"2 3 7.0/\n"
|
||||
"/\n"
|
||||
"\n";
|
||||
|
||||
|
||||
const std::string& inputStrNoSolutionSection = "RUNSPEC\n"
|
||||
"EQLOPTS\n"
|
||||
"THPRES /\n "
|
||||
@@ -123,7 +162,9 @@ const std::string& inputStrMissingPressure = "RUNSPEC\n"
|
||||
"EQLOPTS\n"
|
||||
"THPRES /\n "
|
||||
"\n"
|
||||
|
||||
"REGIONS\n"
|
||||
"EQLNUM\n"
|
||||
" 27*3 /\n"
|
||||
"SOLUTION\n"
|
||||
"THPRES\n"
|
||||
"1 2 12.0/\n"
|
||||
@@ -140,23 +181,28 @@ static DeckPtr createDeck(const ParseContext& parseContext , const std::string&
|
||||
return parser.parseString(input , parseContext);
|
||||
}
|
||||
|
||||
static GridProperties<int> getGridProperties(int defaultEqlnum = 3, bool addKeyword = true) {
|
||||
GridPropertySupportedKeywordInfo<int> kwInfo = GridPropertySupportedKeywordInfo<int>( "EQLNUM", defaultEqlnum, "" );
|
||||
std::vector<GridPropertySupportedKeywordInfo<int>> supportedKeywordsVec( 1, kwInfo );
|
||||
const EclipseGrid eclipseGrid( 3, 3, 3 );
|
||||
GridProperties<int> gridProperties( eclipseGrid, std::move( supportedKeywordsVec ) );
|
||||
if (addKeyword) {
|
||||
gridProperties.addKeyword("EQLNUM");
|
||||
}
|
||||
return gridProperties;
|
||||
static Eclipse3DProperties getEclipseProperties(const Deck& deck,
|
||||
ParseContext& parseContext)
|
||||
{
|
||||
static const EclipseGrid eclipseGrid( 3, 3, 3 );
|
||||
return Eclipse3DProperties( deck, TableManager( deck ), eclipseGrid );
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ThresholdPressureDeckHasEqlnum) {
|
||||
ParseContext parseContext;
|
||||
DeckPtr deck = createDeck(parseContext , inputStrWithEqlNum);
|
||||
auto ep = getEclipseProperties( *deck, parseContext );
|
||||
|
||||
BOOST_CHECK (ep.hasDeckIntGridProperty("EQLNUM"));
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ThresholdPressureTest) {
|
||||
ParseContext parseContext;
|
||||
DeckPtr deck = createDeck(parseContext , inputStr);
|
||||
auto gridProperties = getGridProperties();
|
||||
ThresholdPressureConstPtr thp = std::make_shared<ThresholdPressure>(parseContext , deck, gridProperties);
|
||||
|
||||
DeckPtr deck = createDeck(parseContext , inputStrWithEqlNum);
|
||||
auto ep = getEclipseProperties( *deck, parseContext );
|
||||
ThresholdPressureConstPtr thp = std::make_shared<ThresholdPressure>(parseContext , *deck, ep);
|
||||
|
||||
BOOST_CHECK_EQUAL( thp->getThresholdPressure(1,2) , 1200000.0 );
|
||||
BOOST_CHECK_EQUAL( thp->getThresholdPressure(2,1) , 1200000.0 );
|
||||
@@ -171,8 +217,8 @@ BOOST_AUTO_TEST_CASE(ThresholdPressureTest) {
|
||||
BOOST_AUTO_TEST_CASE(ThresholdPressureEmptyTest) {
|
||||
ParseContext parseContext;
|
||||
DeckPtr deck = createDeck(parseContext , inputStrNoSolutionSection);
|
||||
auto gridProperties = getGridProperties();
|
||||
ThresholdPressureConstPtr thresholdPressurePtr = std::make_shared<ThresholdPressure>(parseContext , deck, gridProperties);
|
||||
auto ep = getEclipseProperties(*deck, parseContext);
|
||||
ThresholdPressureConstPtr thresholdPressurePtr = std::make_shared<ThresholdPressure>(parseContext , *deck, ep);
|
||||
BOOST_CHECK_EQUAL(0, thresholdPressurePtr->size());
|
||||
}
|
||||
|
||||
@@ -181,12 +227,13 @@ BOOST_AUTO_TEST_CASE(ThresholdPressureNoTHPREStest) {
|
||||
ParseContext parseContext;
|
||||
DeckPtr deck_no_thpres = createDeck(parseContext , inputStrNoTHPRESinSolutionNorRUNSPEC);
|
||||
DeckPtr deck_no_thpres2 = createDeck(parseContext , inputStrTHPRESinRUNSPECnotSoultion);
|
||||
auto gridProperties = getGridProperties();
|
||||
auto ep = getEclipseProperties(*deck_no_thpres, parseContext);
|
||||
auto ep2 = getEclipseProperties(*deck_no_thpres2, parseContext);
|
||||
|
||||
ThresholdPressureConstPtr thresholdPressurePtr;
|
||||
BOOST_CHECK_NO_THROW(thresholdPressurePtr = std::make_shared<ThresholdPressure>(parseContext , deck_no_thpres, gridProperties));
|
||||
BOOST_CHECK_NO_THROW(thresholdPressurePtr = std::make_shared<ThresholdPressure>(parseContext , *deck_no_thpres, ep));
|
||||
ThresholdPressureConstPtr thresholdPressurePtr2;
|
||||
BOOST_CHECK_NO_THROW(thresholdPressurePtr2 = std::make_shared<ThresholdPressure>(parseContext , deck_no_thpres2, gridProperties));
|
||||
BOOST_CHECK_NO_THROW(thresholdPressurePtr2 = std::make_shared<ThresholdPressure>(parseContext , *deck_no_thpres2, ep2));
|
||||
|
||||
BOOST_CHECK_EQUAL(0, thresholdPressurePtr->size());
|
||||
BOOST_CHECK_EQUAL(0, thresholdPressurePtr2->size());
|
||||
@@ -196,33 +243,42 @@ BOOST_AUTO_TEST_CASE(ThresholdPressureNoTHPREStest) {
|
||||
BOOST_AUTO_TEST_CASE(ThresholdPressureThrowTest) {
|
||||
ParseContext parseContext;
|
||||
DeckPtr deck = createDeck(parseContext , inputStr);
|
||||
DeckPtr deck_all0 = createDeck(parseContext , inputStrWithEqlNumall0);
|
||||
DeckPtr deck_irrevers = createDeck(parseContext , inputStrIrrevers);
|
||||
DeckPtr deck_inconsistency = createDeck(parseContext , inputStrInconsistency);
|
||||
DeckPtr deck_highRegNum = createDeck(parseContext , inputStrTooHighRegionNumbers);
|
||||
DeckPtr deck_missingData = createDeck(parseContext , inputStrMissingData);
|
||||
DeckPtr deck_missingPressure = createDeck(parseContext , inputStrMissingPressure);
|
||||
auto gridProperties = getGridProperties();
|
||||
|
||||
BOOST_CHECK_THROW(std::make_shared<ThresholdPressure>(parseContext,deck_irrevers, gridProperties), std::runtime_error);
|
||||
BOOST_CHECK_THROW(std::make_shared<ThresholdPressure>(parseContext,deck_inconsistency, gridProperties), std::runtime_error);
|
||||
BOOST_CHECK_THROW(std::make_shared<ThresholdPressure>(parseContext,deck_highRegNum, gridProperties), std::runtime_error);
|
||||
BOOST_CHECK_THROW(std::make_shared<ThresholdPressure>(parseContext,deck_missingData, gridProperties), std::runtime_error);
|
||||
auto ep = getEclipseProperties(*deck , parseContext);
|
||||
auto ep_irrevers = getEclipseProperties(*deck_irrevers , parseContext);
|
||||
auto ep_inconsistency = getEclipseProperties(*deck_inconsistency , parseContext);
|
||||
auto ep_highRegNum = getEclipseProperties(*deck_highRegNum , parseContext);
|
||||
auto ep_missingData = getEclipseProperties(*deck_missingData , parseContext);
|
||||
auto ep_missingPressure = getEclipseProperties(*deck_missingPressure , parseContext);
|
||||
|
||||
BOOST_CHECK_THROW(std::make_shared<ThresholdPressure>(parseContext,*deck_irrevers, ep_irrevers), std::runtime_error);
|
||||
BOOST_CHECK_THROW(std::make_shared<ThresholdPressure>(parseContext,*deck_inconsistency, ep_inconsistency), std::runtime_error);
|
||||
BOOST_CHECK_THROW(std::make_shared<ThresholdPressure>(parseContext,*deck_highRegNum, ep_highRegNum), std::runtime_error);
|
||||
BOOST_CHECK_THROW(std::make_shared<ThresholdPressure>(parseContext,*deck_missingData, ep_missingData), std::runtime_error);
|
||||
|
||||
{
|
||||
auto gridPropertiesEQLNUMkeywordNotAdded = getGridProperties(3, false);
|
||||
BOOST_CHECK_THROW(std::make_shared<ThresholdPressure>(parseContext , deck, gridPropertiesEQLNUMkeywordNotAdded), std::runtime_error);
|
||||
auto gridPropertiesEQLNUMkeywordNotAdded = getEclipseProperties( *deck, parseContext);
|
||||
BOOST_CHECK_THROW(
|
||||
std::make_shared<ThresholdPressure>( parseContext, *deck, gridPropertiesEQLNUMkeywordNotAdded ),
|
||||
std::runtime_error );
|
||||
}
|
||||
{
|
||||
auto gridPropertiesEQLNUMall0 = getGridProperties(0);
|
||||
BOOST_CHECK_THROW(std::make_shared<ThresholdPressure>(parseContext , deck, gridPropertiesEQLNUMall0), std::runtime_error);
|
||||
auto gridPropertiesEQLNUMall0 = getEclipseProperties(*deck_all0, parseContext);
|
||||
BOOST_CHECK_THROW(std::make_shared<ThresholdPressure>(parseContext , *deck, gridPropertiesEQLNUMall0), std::runtime_error);
|
||||
}
|
||||
|
||||
parseContext.update( ParseContext::UNSUPPORTED_INITIAL_THPRES , InputError::IGNORE );
|
||||
BOOST_CHECK_NO_THROW(ThresholdPressure(parseContext,deck_missingPressure, gridProperties));
|
||||
BOOST_CHECK_NO_THROW(ThresholdPressure(parseContext,*deck_missingPressure, ep_missingPressure));
|
||||
|
||||
|
||||
{
|
||||
ThresholdPressure thp(parseContext , deck_missingPressure , gridProperties );
|
||||
ThresholdPressure thp(parseContext , *deck_missingPressure , ep_missingPressure );
|
||||
|
||||
BOOST_CHECK_EQUAL( true , thp.hasRegionBarrier(2,3));
|
||||
BOOST_CHECK_EQUAL( false , thp.hasThresholdPressure(2,3));
|
||||
@@ -237,10 +293,10 @@ BOOST_AUTO_TEST_CASE(ThresholdPressureThrowTest) {
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(HasPair) {
|
||||
ParseContext parseContext;
|
||||
DeckPtr deck = createDeck(parseContext , inputStr);
|
||||
auto gridProperties = getGridProperties();
|
||||
ThresholdPressure thp(parseContext , deck , gridProperties);
|
||||
ParseContext parseContext;
|
||||
DeckPtr deck = createDeck(parseContext , inputStrWithEqlNum);
|
||||
auto ep = getEclipseProperties(*deck, parseContext);
|
||||
ThresholdPressure thp(parseContext , *deck , ep);
|
||||
|
||||
BOOST_CHECK_EQUAL( true , thp.hasRegionBarrier( 1 , 2 ));
|
||||
BOOST_CHECK_EQUAL( false , thp.hasRegionBarrier( 1 , 7 ));
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
/*
|
||||
Copyright 2013 Statoil ASA.
|
||||
Copyright 2013 Statoil ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
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 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.
|
||||
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/>.
|
||||
*/
|
||||
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>
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <opm/common/utility/platform_dependent/reenable_warnings.h>
|
||||
|
||||
#include <opm/common/OpmLog/OpmLog.hpp>
|
||||
#include <opm/common/OpmLog/CounterLog.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
|
||||
@@ -56,53 +57,51 @@ using namespace Opm;
|
||||
|
||||
|
||||
static DeckPtr createDeckTOP() {
|
||||
const char *deckData =
|
||||
"RUNSPEC\n"
|
||||
"\n"
|
||||
"DIMENS\n"
|
||||
" 10 10 10 /\n"
|
||||
"GRID\n"
|
||||
"DX\n"
|
||||
"1000*0.25 /\n"
|
||||
"DYV\n"
|
||||
"10*0.25 /\n"
|
||||
"DZ\n"
|
||||
"1000*0.25 /\n"
|
||||
"TOPS\n"
|
||||
"1000*0.25 /\n"
|
||||
"PORO \n"
|
||||
"100*0.10 /\n"
|
||||
"PERMX \n"
|
||||
"100*0.25 /\n"
|
||||
"EDIT\n"
|
||||
"OIL\n"
|
||||
"\n"
|
||||
"GAS\n"
|
||||
"\n"
|
||||
"TITLE\n"
|
||||
"The title\n"
|
||||
"\n"
|
||||
"START\n"
|
||||
"8 MAR 1998 /\n"
|
||||
"\n"
|
||||
"PROPS\n"
|
||||
"REGIONS\n"
|
||||
"SWAT\n"
|
||||
"1000*1 /\n"
|
||||
"SATNUM\n"
|
||||
"1000*2 /\n"
|
||||
"\n";
|
||||
const char *deckData =
|
||||
"RUNSPEC\n"
|
||||
"\n"
|
||||
"DIMENS\n"
|
||||
" 10 10 10 /\n"
|
||||
"GRID\n"
|
||||
"DX\n"
|
||||
"1000*0.25 /\n"
|
||||
"DYV\n"
|
||||
"10*0.25 /\n"
|
||||
"DZ\n"
|
||||
"1000*0.25 /\n"
|
||||
"TOPS\n"
|
||||
"1000*0.25 /\n"
|
||||
"PORO \n"
|
||||
"100*0.10 /\n"
|
||||
"PERMX \n"
|
||||
"100*0.25 /\n"
|
||||
"EDIT\n"
|
||||
"OIL\n"
|
||||
"\n"
|
||||
"GAS\n"
|
||||
"\n"
|
||||
"TITLE\n"
|
||||
"The title\n"
|
||||
"\n"
|
||||
"START\n"
|
||||
"8 MAR 1998 /\n"
|
||||
"\n"
|
||||
"PROPS\n"
|
||||
"REGIONS\n"
|
||||
"SWAT\n"
|
||||
"1000*1 /\n"
|
||||
"SATNUM\n"
|
||||
"1000*2 /\n"
|
||||
"\n";
|
||||
|
||||
ParserPtr parser(new Parser());
|
||||
return parser->parseString(deckData, ParseContext()) ;
|
||||
ParserPtr parser(new Parser());
|
||||
return parser->parseString(deckData, ParseContext()) ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(GetPOROTOPBased) {
|
||||
DeckPtr deck = createDeckTOP();
|
||||
EclipseState state(deck , ParseContext());
|
||||
auto& props = state.getEclipseProperties();
|
||||
const Eclipse3DProperties& props = state.getEclipseProperties();
|
||||
|
||||
const GridProperty<double>& poro = props.getDoubleGridProperty( "PORO" );
|
||||
const GridProperty<double>& permx = props.getDoubleGridProperty( "PERMX" );
|
||||
@@ -113,155 +112,153 @@ BOOST_AUTO_TEST_CASE(GetPOROTOPBased) {
|
||||
BOOST_CHECK_EQUAL( 0.10 , poro.iget(i) );
|
||||
BOOST_CHECK_EQUAL( 0.25 * Metric::Permeability , permx.iget(i) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
static DeckPtr createDeck() {
|
||||
const char *deckData =
|
||||
"RUNSPEC\n"
|
||||
"\n"
|
||||
"DIMENS\n"
|
||||
" 10 10 10 /\n"
|
||||
"GRID\n"
|
||||
"FAULTS \n"
|
||||
" 'F1' 1 1 1 4 1 4 'X' / \n"
|
||||
" 'F2' 5 5 1 4 1 4 'X-' / \n"
|
||||
"/\n"
|
||||
"MULTFLT \n"
|
||||
" 'F1' 0.50 / \n"
|
||||
" 'F2' 0.50 / \n"
|
||||
"/\n"
|
||||
"EDIT\n"
|
||||
"MULTFLT /\n"
|
||||
" 'F2' 0.25 / \n"
|
||||
"/\n"
|
||||
"OIL\n"
|
||||
"\n"
|
||||
"GAS\n"
|
||||
"\n"
|
||||
"TITLE\n"
|
||||
"The title\n"
|
||||
"\n"
|
||||
"START\n"
|
||||
"8 MAR 1998 /\n"
|
||||
"\n"
|
||||
"PROPS\n"
|
||||
"REGIONS\n"
|
||||
"SWAT\n"
|
||||
"1000*1 /\n"
|
||||
"SATNUM\n"
|
||||
"1000*2 /\n"
|
||||
"\n";
|
||||
const char *deckData =
|
||||
"RUNSPEC\n"
|
||||
"\n"
|
||||
"DIMENS\n"
|
||||
" 10 10 10 /\n"
|
||||
"GRID\n"
|
||||
"FAULTS \n"
|
||||
" 'F1' 1 1 1 4 1 4 'X' / \n"
|
||||
" 'F2' 5 5 1 4 1 4 'X-' / \n"
|
||||
"/\n"
|
||||
"MULTFLT \n"
|
||||
" 'F1' 0.50 / \n"
|
||||
" 'F2' 0.50 / \n"
|
||||
"/\n"
|
||||
"EDIT\n"
|
||||
"MULTFLT /\n"
|
||||
" 'F2' 0.25 / \n"
|
||||
"/\n"
|
||||
"OIL\n"
|
||||
"\n"
|
||||
"GAS\n"
|
||||
"\n"
|
||||
"TITLE\n"
|
||||
"The title\n"
|
||||
"\n"
|
||||
"START\n"
|
||||
"8 MAR 1998 /\n"
|
||||
"\n"
|
||||
"PROPS\n"
|
||||
"REGIONS\n"
|
||||
"SWAT\n"
|
||||
"1000*1 /\n"
|
||||
"SATNUM\n"
|
||||
"1000*2 /\n"
|
||||
"\n";
|
||||
|
||||
ParserPtr parser(new Parser());
|
||||
return parser->parseString(deckData, ParseContext()) ;
|
||||
ParserPtr parser(new Parser());
|
||||
return parser->parseString(deckData, ParseContext()) ;
|
||||
}
|
||||
|
||||
|
||||
static DeckPtr createDeckNoFaults() {
|
||||
const char *deckData =
|
||||
"RUNSPEC\n"
|
||||
"\n"
|
||||
"DIMENS\n"
|
||||
" 10 10 10 /\n"
|
||||
"GRID\n"
|
||||
"PROPS\n"
|
||||
"-- multiply one layer for each face\n"
|
||||
"MULTX\n"
|
||||
" 100*1 100*10 800*1 /\n"
|
||||
"MULTX-\n"
|
||||
" 200*1 100*11 700*1 /\n"
|
||||
"MULTY\n"
|
||||
" 300*1 100*12 600*1 /\n"
|
||||
"MULTY-\n"
|
||||
" 400*1 100*13 500*1 /\n"
|
||||
"MULTZ\n"
|
||||
" 500*1 100*14 400*1 /\n"
|
||||
"MULTZ-\n"
|
||||
" 600*1 100*15 300*1 /\n"
|
||||
"\n";
|
||||
const char *deckData =
|
||||
"RUNSPEC\n"
|
||||
"\n"
|
||||
"DIMENS\n"
|
||||
" 10 10 10 /\n"
|
||||
"GRID\n"
|
||||
"PROPS\n"
|
||||
"-- multiply one layer for each face\n"
|
||||
"MULTX\n"
|
||||
" 100*1 100*10 800*1 /\n"
|
||||
"MULTX-\n"
|
||||
" 200*1 100*11 700*1 /\n"
|
||||
"MULTY\n"
|
||||
" 300*1 100*12 600*1 /\n"
|
||||
"MULTY-\n"
|
||||
" 400*1 100*13 500*1 /\n"
|
||||
"MULTZ\n"
|
||||
" 500*1 100*14 400*1 /\n"
|
||||
"MULTZ-\n"
|
||||
" 600*1 100*15 300*1 /\n"
|
||||
"\n";
|
||||
|
||||
ParserPtr parser(new Parser());
|
||||
return parser->parseString(deckData, ParseContext()) ;
|
||||
ParserPtr parser(new Parser());
|
||||
return parser->parseString(deckData, ParseContext()) ;
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(CreateSchedule) {
|
||||
DeckPtr deck = createDeck();
|
||||
EclipseState state(deck , ParseContext());
|
||||
ScheduleConstPtr schedule = state.getSchedule();
|
||||
EclipseGridConstPtr eclipseGrid = state.getEclipseGrid();
|
||||
DeckPtr deck = createDeck();
|
||||
EclipseState state(deck , ParseContext());
|
||||
ScheduleConstPtr schedule = state.getSchedule();
|
||||
EclipseGridConstPtr eclipseGrid = state.getEclipseGrid();
|
||||
|
||||
BOOST_CHECK_EQUAL( schedule->getStartTime() , boost::posix_time::ptime(boost::gregorian::date(1998 , 3 , 8 )));
|
||||
BOOST_CHECK_EQUAL( schedule->getStartTime() , boost::posix_time::ptime(boost::gregorian::date(1998 , 3 , 8 )));
|
||||
}
|
||||
|
||||
|
||||
|
||||
static DeckPtr createDeckSimConfig() {
|
||||
const std::string& inputStr = "RUNSPEC\n"
|
||||
"EQLOPTS\n"
|
||||
"THPRES /\n "
|
||||
"DIMENS\n"
|
||||
"10 3 4 /\n"
|
||||
"\n"
|
||||
"GRID\n"
|
||||
"REGIONS\n"
|
||||
"EQLNUM\n"
|
||||
"10*1 10*2 100*3 /\n "
|
||||
"\n"
|
||||
const std::string& inputStr = "RUNSPEC\n"
|
||||
"EQLOPTS\n"
|
||||
"THPRES /\n "
|
||||
"DIMENS\n"
|
||||
"10 3 4 /\n"
|
||||
"\n"
|
||||
"GRID\n"
|
||||
"REGIONS\n"
|
||||
"EQLNUM\n"
|
||||
"10*1 10*2 100*3 /\n "
|
||||
"\n"
|
||||
|
||||
"SOLUTION\n"
|
||||
"THPRES\n"
|
||||
"1 2 12.0/\n"
|
||||
"1 3 5.0/\n"
|
||||
"2 3 7.0/\n"
|
||||
"/\n"
|
||||
"\n";
|
||||
"SOLUTION\n"
|
||||
"THPRES\n"
|
||||
"1 2 12.0/\n"
|
||||
"1 3 5.0/\n"
|
||||
"2 3 7.0/\n"
|
||||
"/\n"
|
||||
"\n";
|
||||
|
||||
|
||||
ParserPtr parser(new Parser());
|
||||
return parser->parseString(inputStr, ParseContext()) ;
|
||||
ParserPtr parser(new Parser());
|
||||
return parser->parseString(inputStr, ParseContext()) ;
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(CreateSimulationConfig) {
|
||||
|
||||
DeckPtr deck = createDeckSimConfig();
|
||||
EclipseState state(deck, ParseContext());
|
||||
SimulationConfigConstPtr simulationConfig = state.getSimulationConfig();
|
||||
BOOST_CHECK(simulationConfig->hasThresholdPressure());
|
||||
std::shared_ptr<const ThresholdPressure> thresholdPressure = simulationConfig->getThresholdPressure();
|
||||
BOOST_CHECK_EQUAL(thresholdPressure->size(), 3);
|
||||
DeckPtr deck = createDeckSimConfig();
|
||||
EclipseState state(deck, ParseContext());
|
||||
SimulationConfigConstPtr simConf = state.getSimulationConfig();
|
||||
|
||||
BOOST_CHECK( simConf->hasThresholdPressure() );
|
||||
|
||||
std::shared_ptr<const ThresholdPressure> thresholdPressure = simConf->getThresholdPressure();
|
||||
BOOST_CHECK_EQUAL(thresholdPressure->size(), 3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(PhasesCorrect) {
|
||||
DeckPtr deck = createDeck();
|
||||
EclipseState state(deck, ParseContext());
|
||||
const auto& tm = *state.getTableManager();
|
||||
BOOST_CHECK( tm.hasPhase( Phase::PhaseEnum::OIL ));
|
||||
BOOST_CHECK( tm.hasPhase( Phase::PhaseEnum::GAS ));
|
||||
BOOST_CHECK( !tm.hasPhase( Phase::PhaseEnum::WATER ));
|
||||
EclipseState state( deck, ParseContext() );
|
||||
const auto& tm = state.getTableManager();
|
||||
BOOST_CHECK( tm.hasPhase( Phase::PhaseEnum::OIL ));
|
||||
BOOST_CHECK( tm.hasPhase( Phase::PhaseEnum::GAS ));
|
||||
BOOST_CHECK( ! tm.hasPhase( Phase::PhaseEnum::WATER ));
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(TitleCorrect) {
|
||||
DeckPtr deck = createDeck();
|
||||
EclipseState state(deck, ParseContext());
|
||||
EclipseState state( deck, ParseContext() );
|
||||
|
||||
BOOST_CHECK_EQUAL( state.getTitle(), "The title");
|
||||
BOOST_CHECK_EQUAL( state.getTitle(), "The title" );
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(IntProperties) {
|
||||
DeckPtr deck = createDeck();
|
||||
EclipseState state(deck, ParseContext());
|
||||
EclipseState state( deck, ParseContext() );
|
||||
|
||||
BOOST_CHECK( ! state.getEclipseProperties().supportsGridProperty("NONO"));
|
||||
BOOST_CHECK( state.getEclipseProperties().supportsGridProperty("SATNUM"));
|
||||
BOOST_CHECK( state.getEclipseProperties().hasDeckIntGridProperty("SATNUM"));
|
||||
BOOST_CHECK_EQUAL( false, state.getEclipseProperties().supportsGridProperty( "NONO" ) );
|
||||
BOOST_CHECK_EQUAL( true, state.getEclipseProperties().supportsGridProperty( "SATNUM" ) );
|
||||
BOOST_CHECK_EQUAL( true, state.getEclipseProperties().hasDeckIntGridProperty( "SATNUM" ) );
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(PropertiesNotSupportsFalse) {
|
||||
@@ -284,37 +281,33 @@ BOOST_AUTO_TEST_CASE(GetProperty) {
|
||||
BOOST_CHECK_THROW( satNUM.iget(100000) , std::invalid_argument);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(GetTransMult) {
|
||||
DeckPtr deck = createDeck();
|
||||
EclipseState state(deck, ParseContext());
|
||||
EclipseState state( deck, ParseContext() );
|
||||
std::shared_ptr<const TransMult> transMult = state.getTransMult();
|
||||
|
||||
|
||||
BOOST_CHECK_EQUAL( 1.0 , transMult->getMultiplier(1,0,0,FaceDir::XPlus));
|
||||
BOOST_CHECK_THROW(transMult->getMultiplier(1000 , FaceDir::XPlus) , std::invalid_argument);
|
||||
BOOST_CHECK_EQUAL( 1.0, transMult->getMultiplier( 1, 0, 0, FaceDir::XPlus ) );
|
||||
BOOST_CHECK_THROW( transMult->getMultiplier( 1000, FaceDir::XPlus ), std::invalid_argument );
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(GetFaults) {
|
||||
DeckPtr deck = createDeck();
|
||||
EclipseState state(deck , ParseContext());
|
||||
EclipseState state( deck, ParseContext() );
|
||||
std::shared_ptr<const FaultCollection> faults = state.getFaults();
|
||||
|
||||
BOOST_CHECK( faults->hasFault("F1") );
|
||||
BOOST_CHECK( faults->hasFault("F2") );
|
||||
BOOST_CHECK( faults->hasFault( "F1" ) );
|
||||
BOOST_CHECK( faults->hasFault( "F2" ) );
|
||||
|
||||
std::shared_ptr<const Fault> F1 = faults->getFault("F1");
|
||||
std::shared_ptr<const Fault> F2 = faults->getFault("F2");
|
||||
std::shared_ptr<const Fault> F1 = faults->getFault( "F1" );
|
||||
std::shared_ptr<const Fault> F2 = faults->getFault( "F2" );
|
||||
|
||||
BOOST_CHECK_EQUAL( 0.50 , F1->getTransMult());
|
||||
BOOST_CHECK_EQUAL( 0.25 , F2->getTransMult());
|
||||
BOOST_CHECK_EQUAL( 0.50, F1->getTransMult() );
|
||||
BOOST_CHECK_EQUAL( 0.25, F2->getTransMult() );
|
||||
|
||||
std::shared_ptr<const TransMult> transMult = state.getTransMult();
|
||||
BOOST_CHECK_EQUAL( transMult->getMultiplier(0 , 0 , 0 , FaceDir::XPlus) , 0.50 );
|
||||
BOOST_CHECK_EQUAL( transMult->getMultiplier(4 , 3 , 0 , FaceDir::XMinus) , 0.25 );
|
||||
BOOST_CHECK_EQUAL( transMult->getMultiplier(4 , 3 , 0 , FaceDir::ZPlus) , 1.00 );
|
||||
BOOST_CHECK_EQUAL( transMult->getMultiplier( 0, 0, 0, FaceDir::XPlus ), 0.50 );
|
||||
BOOST_CHECK_EQUAL( transMult->getMultiplier( 4, 3, 0, FaceDir::XMinus ), 0.25 );
|
||||
BOOST_CHECK_EQUAL( transMult->getMultiplier( 4, 3, 0, FaceDir::ZPlus ), 1.00 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user