Add support for WEFAC

This commit is contained in:
Tor Harald Sandve 2017-11-21 09:55:07 +01:00
parent 7f02fdc409
commit 7aaad448d4
6 changed files with 103 additions and 0 deletions

View File

@ -149,6 +149,7 @@ namespace Opm
void handleGCONINJE( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep);
void handleGCONPROD( const DeckKeyword& keyword, size_t currentStep);
void handleGEFAC( const DeckKeyword& keyword, size_t currentStep);
void handleWEFAC( const DeckKeyword& keyword, size_t currentStep);
void handleTUNING( const DeckKeyword& keyword, size_t currentStep);
void handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep);
void handleWRFT( const DeckKeyword& keyword, size_t currentStep);

View File

@ -84,6 +84,9 @@ namespace Opm {
double getGuideRateScalingFactor(size_t timeStep) const;
void setGuideRateScalingFactor(size_t timeStep, double scalingFactor);
void setEfficiencyFactor (size_t timestep, double efficiencyFactor);
double getEfficiencyFactor (size_t timestep) const;
void switchToInjector( size_t timeStep);
void switchToProducer( size_t timeStep);
@ -171,6 +174,7 @@ namespace Opm {
DynamicState< double > m_guideRate;
DynamicState< GuideRate::GuideRatePhaseEnum > m_guideRatePhase;
DynamicState< double > m_guideRateScalingFactor;
DynamicState< double > m_efficiencyFactors;
DynamicState< int > m_isProducer;
DynamicState< CompletionSet > m_completions;

View File

@ -233,6 +233,9 @@ namespace Opm {
else if (keyword.name() == "MESSAGES")
handleMESSAGES(keyword, currentStep);
else if (keyword.name() == "WEFAC")
handleWEFAC(keyword, currentStep);
else if (geoModifiers.find( keyword.name() ) != geoModifiers.end()) {
bool supported = geoModifiers.at( keyword.name() );
if (supported) {
@ -682,6 +685,17 @@ namespace Opm {
}
}
void Schedule::handleWEFAC( const DeckKeyword& keyword, size_t currentStep) {
for( const auto& record : keyword ) {
const std::string& wellNamePattern = record.getItem("WELLNAME").getTrimmedString(0);
const double& efficiencyFactor = record.getItem("EFFICIENCY_FACTOR").get< double >(0);
for( auto* well : getWells( wellNamePattern ) ) {
well->setEfficiencyFactor(currentStep, efficiencyFactor);
}
}
}
void Schedule::handleWSOLVENT( const DeckKeyword& keyword, size_t currentStep) {

View File

@ -44,6 +44,7 @@ namespace Opm {
m_guideRate( timeMap, -1.0 ),
m_guideRatePhase( timeMap, GuideRate::UNDEFINED ),
m_guideRateScalingFactor( timeMap, 1.0 ),
m_efficiencyFactors (timeMap, 1.0 ),
m_isProducer( timeMap, true ) ,
m_completions( timeMap, CompletionSet{} ),
m_productionProperties( timeMap, WellProductionProperties() ),
@ -280,6 +281,14 @@ namespace Opm {
m_guideRateScalingFactor.update(timeStep, scalingFactor);
}
double Well::getEfficiencyFactor (size_t timeStep) const {
return m_efficiencyFactors.get(timeStep);
}
void Well::setEfficiencyFactor(size_t timeStep, double scalingFactor) {
m_efficiencyFactors.update(timeStep, scalingFactor);
}
/*****************************************************************/
// WELSPECS

View File

@ -2111,3 +2111,70 @@ BOOST_AUTO_TEST_CASE(GuideRatePhaseEnum2Loop) {
BOOST_CHECK_EQUAL( "UNDEFINED" , GuideRate::GuideRatePhaseEnum2String(GuideRate::GuideRatePhaseEnumFromString( "UNDEFINED" ) ));
}
BOOST_AUTO_TEST_CASE(handleWEFAC) {
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"
" 'P' 'OP' 9 9 1* 'OIL' 1* 1* 1* 1* 1* 1* 1* / \n"
" 'I' 'OP' 1 1 1* 'WATER' 1* 1* 1* 1* 1* 1* 1* / \n"
"/\n"
"COMPDAT\n"
" 'P' 9 9 1 1 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
" 'P' 9 9 2 2 'OPEN' 1* 46.825 0.311 4332.346 1* 1* 'X' 22.123 / \n"
" 'I' 1 1 1 1 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
"/\n"
"WCONHIST\n"
" 'P' 'OPEN' 'RESV' 6* 500 / \n"
"/\n"
"WCONINJH\n"
" 'I' 'WATER' 1* 100 250 / \n"
"/\n"
"WEFAC\n"
" 'P' 0.5 / \n"
" 'I' 0.9 / \n"
"/\n"
"DATES -- 2\n"
" 15 OKT 2008 / \n"
"/\n"
"DATES -- 3\n"
" 18 OKT 2008 / \n"
"/\n"
"WEFAC\n"
" 'P' 1.0 / \n"
"/\n"
;
ParseContext parseContext;
auto deck = parser.parseString(input, parseContext);
EclipseGrid grid(10,10,10);
TableManager table ( deck );
Eclipse3DProperties eclipseProperties ( deck , table, grid);
Schedule schedule(deck, grid , eclipseProperties, Phases(true, true, true) , parseContext);
auto* well_p = schedule.getWell("P");
auto* well_i = schedule.getWell("I");
//start
BOOST_CHECK_EQUAL(well_p->getEfficiencyFactor(0), 1.0);
BOOST_CHECK_EQUAL(well_i->getEfficiencyFactor(0), 1.0);
//1
BOOST_CHECK_EQUAL(well_p->getEfficiencyFactor(1), 0.5);
BOOST_CHECK_EQUAL(well_i->getEfficiencyFactor(1), 0.9);
//2
BOOST_CHECK_EQUAL(well_p->getEfficiencyFactor(2), 0.5);
BOOST_CHECK_EQUAL(well_i->getEfficiencyFactor(2), 0.9);
//3
BOOST_CHECK_EQUAL(well_p->getEfficiencyFactor(3), 1.0);
BOOST_CHECK_EQUAL(well_i->getEfficiencyFactor(3), 0.9);
}

View File

@ -777,6 +777,14 @@ BOOST_AUTO_TEST_CASE(WellGuideRatePhase_GuideRatePhaseSet) {
BOOST_CHECK_EQUAL(Opm::GuideRate::RAT, well.getGuideRatePhase(3));
}
BOOST_AUTO_TEST_CASE(WellEfficiencyFactorSet) {
auto timeMap = createXDaysTimeMap(20);
Opm::Well well("WELL1", 1, 2, 2334.32, Opm::Phase::WATER, timeMap, 0);
BOOST_CHECK_EQUAL(1.0, well.getEfficiencyFactor(0));
well.setEfficiencyFactor(3, 0.9);
BOOST_CHECK_EQUAL(1.0, well.getEfficiencyFactor(0));
BOOST_CHECK_EQUAL(0.9, well.getEfficiencyFactor(3));
}
BOOST_AUTO_TEST_CASE(WellSetScalingFactor_ScalingFactorSetSet) {
auto timeMap = createXDaysTimeMap(20);