Merge pull request #488 from iLoop2/OPM-97

Added WPIMULT keyword support
This commit is contained in:
Joakim Hove
2015-06-13 00:17:22 +02:00
6 changed files with 216 additions and 13 deletions

View File

@@ -33,8 +33,9 @@ namespace Opm {
m_connectionTransmissibilityFactor(connectionTransmissibilityFactor),
m_skinFactor(skinFactor),
m_state(state),
m_direction(direction)
{ }
m_direction(direction),
m_wellPi(1.0)
{}
Completion::Completion(std::shared_ptr<const Completion> oldCompletion, WellCompletion::StateEnum newStatus)
:
@@ -45,9 +46,29 @@ namespace Opm {
m_connectionTransmissibilityFactor(oldCompletion->getConnectionTransmissibilityFactorAsValueObject()),
m_skinFactor(oldCompletion->getSkinFactorAsValueObject()),
m_state(newStatus),
m_direction(oldCompletion->getDirection())
m_direction(oldCompletion->getDirection()),
m_wellPi(oldCompletion->getWellPi())
{}
Completion::Completion(std::shared_ptr<const Completion> oldCompletion, double wellPi)
:
m_i(oldCompletion->getI()),
m_j(oldCompletion->getJ()),
m_k(oldCompletion->getK()),
m_diameter(oldCompletion->getDiameterAsValueObject()),
m_connectionTransmissibilityFactor(oldCompletion->getConnectionTransmissibilityFactorAsValueObject()),
m_skinFactor(oldCompletion->getSkinFactorAsValueObject()),
m_state(oldCompletion->getState()),
m_direction(oldCompletion->getDirection()),
m_wellPi(oldCompletion->getWellPi())
{
if(m_wellPi!=0){
m_wellPi*=wellPi;
}else{
m_wellPi=wellPi;
}
}
bool Completion::sameCoordinate(const Completion& other) const {
if ((m_i == other.m_i) &&
@@ -186,6 +207,12 @@ namespace Opm {
WellCompletion::DirectionEnum Completion::getDirection() const {
return m_direction;
}
double Completion::getWellPi() const {
return m_wellPi;
}
}

View File

@@ -42,6 +42,7 @@ namespace Opm {
const WellCompletion::DirectionEnum direction = WellCompletion::DirectionEnum::Z);
Completion(std::shared_ptr<const Completion> oldCompletion, WellCompletion::StateEnum newStatus);
Completion(std::shared_ptr<const Completion> oldCompletion, double wellPi);
bool sameCoordinate(const Completion& other) const;
int getI() const;
@@ -49,6 +50,7 @@ namespace Opm {
int getK() const;
WellCompletion::StateEnum getState() const;
double getConnectionTransmissibilityFactor() const;
double getWellPi() const;
const Value<double>& getConnectionTransmissibilityFactorAsValueObject() const;
double getDiameter() const;
double getSkinFactor() const;
@@ -63,6 +65,7 @@ namespace Opm {
int m_i, m_j, m_k;
Value<double> m_diameter;
Value<double> m_connectionTransmissibilityFactor;
double m_wellPi;
Value<double> m_skinFactor;
WellCompletion::StateEnum m_state;
WellCompletion::DirectionEnum m_direction;

View File

@@ -145,6 +145,10 @@ namespace Opm {
if (keyword->name() == "WRFTPLT")
rftProperties.push_back( std::make_pair( keyword , currentStep ));
if (keyword->name() == "WPIMULT")
handleWPIMULT(keyword, currentStep);
}
for (auto rftPair = rftProperties.begin(); rftPair != rftProperties.end(); ++rftPair) {
@@ -285,6 +289,87 @@ namespace Opm {
handleWCONProducer(keyword, currentStep, true);
}
static Opm::Value<int> getValueItem(DeckItemPtr item){
Opm::Value<int> data(item->name());
if(item->hasValue(0)) {
int tempValue = item->getInt(0);
if( tempValue >0){
data.setValue(tempValue-1);
}
}
return data;
}
void Schedule::handleWPIMULT(DeckKeywordConstPtr keyword, size_t currentStep) {
for (size_t recordNr = 0; recordNr < keyword->size(); recordNr++) {
DeckRecordConstPtr record = keyword->getRecord(recordNr);
const std::string& wellNamePattern = record->getItem("WELL")->getTrimmedString(0);
double wellPi = record->getItem("WELLPI")->getRawDouble(0);
std::vector<WellPtr> wells = getWells(wellNamePattern);
for (auto wellIter=wells.begin(); wellIter != wells.end(); ++wellIter) {
WellPtr well = *wellIter;
CompletionSetConstPtr currentCompletionSet = well->getCompletions(currentStep);
CompletionSetPtr newCompletionSet(new CompletionSet( ));
Opm::Value<int> I = getValueItem(record->getItem("I"));
Opm::Value<int> J = getValueItem(record->getItem("J"));
Opm::Value<int> K = getValueItem(record->getItem("K"));
Opm::Value<int> FIRST = getValueItem(record->getItem("FIRST"));
Opm::Value<int> LAST = getValueItem(record->getItem("LAST"));
size_t completionSize = currentCompletionSet->size();
for(size_t i = 0; i < completionSize;i++) {
CompletionConstPtr currentCompletion = currentCompletionSet->get(i);
if (FIRST.hasValue()) {
if (i < (size_t) FIRST.getValue()) {
newCompletionSet->add(currentCompletion);
continue;
}
}
if (LAST.hasValue()) {
if (i > (size_t) LAST.getValue()) {
newCompletionSet->add(currentCompletion);
continue;
}
}
int ci = currentCompletion->getI();
int cj = currentCompletion->getJ();
int ck = currentCompletion->getK();
if (I.hasValue() && (!(I.getValue() == ci) )) {
newCompletionSet->add(currentCompletion);
continue;
}
if (J.hasValue() && (!(J.getValue() == cj) )) {
newCompletionSet->add(currentCompletion);
continue;
}
if (K.hasValue() && (!(K.getValue() == ck) )) {
newCompletionSet->add(currentCompletion);
continue;
}
CompletionPtr newCompletion = std::make_shared<Completion>(currentCompletion, wellPi);
newCompletionSet->add(newCompletion);
}
well->addCompletionSet(currentStep, newCompletionSet);
}
}
}
void Schedule::handleWCONINJE(DeckConstPtr deck, DeckKeywordConstPtr keyword, size_t currentStep) {
for (size_t recordNr = 0; recordNr < keyword->size(); recordNr++) {
DeckRecordConstPtr record = keyword->getRecord(recordNr);
@@ -414,16 +499,7 @@ namespace Opm {
}
}
static Opm::Value<int> getValueItem(DeckItemPtr item){
Opm::Value<int> data(item->name());
if(item->hasValue(0)) {
int tempValue = item->getInt(0);
if( tempValue >0){
data.setValue(tempValue-1);
}
}
return data;
}
void Schedule::handleWELOPEN(DeckKeywordConstPtr keyword, size_t currentStep , bool hascomplump) {
for (size_t recordNr = 0; recordNr < keyword->size(); recordNr++) {

View File

@@ -108,6 +108,7 @@ namespace Opm
void handleGRUPTREE(DeckKeywordConstPtr keyword, size_t currentStep);
void handleWRFT(DeckKeywordConstPtr keyword, size_t currentStep);
void handleWRFTPLT(DeckKeywordConstPtr keyword, size_t currentStep);
void handleWPIMULT(DeckKeywordConstPtr keyword, size_t currentStep);
void checkUnhandledKeywords(DeckConstPtr deck) const;

View File

@@ -1024,3 +1024,91 @@ BOOST_AUTO_TEST_CASE(createDeckWithRPTSCHEDandRPTRST) {
}
BOOST_AUTO_TEST_CASE(createDeckWithWPIMULT) {
Opm::Parser parser;
std::string input =
"START -- 0 \n"
"19 JUN 2007 / \n"
"SCHEDULE\n"
"DATES -- 1\n"
" 10 OKT 2008 / \n"
"/\n"
"WELSPECS\n"
" 'OP_1' 'OP' 9 9 1* 'OIL' 1* 1* 1* 1* 1* 1* 1* / \n"
"/\n"
"COMPDAT\n"
" 'OP_1' 9 9 1 1 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
" 'OP_1' 9 9 2 2 'OPEN' 1* 46.825 0.311 4332.346 1* 1* 'X' 22.123 / \n"
" 'OP_1' 9 9 3 9 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
"/\n"
"DATES -- 2\n"
" 20 JAN 2010 / \n"
"/\n"
"WELTARG\n"
" OP_1 ORAT 1300 /\n"
" OP_1 WRAT 1400 /\n"
" OP_1 GRAT 1500.52 /\n"
" OP_1 LRAT 1600.58 /\n"
" OP_1 RESV 1801.05 /\n"
" OP_1 BHP 1900 /\n"
" OP_1 THP 2000 /\n"
" OP_1 VFP 2100.09 /\n"
" OP_1 GUID 2300.14 /\n"
"/\n"
"WPIMULT\n"
"OP_1 1.30 /\n"
"/\n"
"DATES -- 3\n"
" 20 JAN 2011 / \n"
"/\n"
"WPIMULT\n"
"OP_1 1.30 /\n"
"/\n"
"DATES -- 4\n"
" 20 JAN 2012 / \n"
"/\n"
"COMPDAT\n"
" 'OP_1' 9 9 1 1 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
" 'OP_1' 9 9 2 2 'OPEN' 1* 46.825 0.311 4332.346 1* 1* 'X' 22.123 / \n"
" 'OP_1' 9 9 3 9 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
"/\n";
DeckPtr deck = parser.parseString(input);
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>(10, 10, 10);
IOConfigPtr ioConfig;
Schedule schedule(grid, deck, ioConfig);
WellPtr well = schedule.getWell("OP_1");
size_t currentStep = 2;
CompletionSetConstPtr currentCompletionSet = well->getCompletions(currentStep);
size_t completionSize = currentCompletionSet->size();
for(size_t i = 0; i < completionSize;i++) {
CompletionConstPtr currentCompletion = currentCompletionSet->get(i);
BOOST_CHECK_EQUAL(currentCompletion->getWellPi(), 1.3);
}
currentStep = 3;
currentCompletionSet = well->getCompletions(currentStep);
completionSize = currentCompletionSet->size();
for(size_t i = 0; i < completionSize;i++) {
CompletionConstPtr currentCompletion = currentCompletionSet->get(i);
BOOST_CHECK_EQUAL(currentCompletion->getWellPi(), (1.3*1.3));
}
currentStep = 4;
currentCompletionSet = well->getCompletions(currentStep);
completionSize = currentCompletionSet->size();
for(size_t i = 0; i < completionSize;i++) {
CompletionConstPtr currentCompletion = currentCompletionSet->get(i);
BOOST_CHECK_EQUAL(currentCompletion->getWellPi(), 1.0);
}
}