Address review comments.
- Use const reference to the dynamic state in handleWFOAM() and handleWPOLYMER(). - Throw if trying to set foam or polymer injection properties on a production well. - Update some tests that failed due to the point above.
This commit is contained in:
@@ -954,7 +954,7 @@ namespace Opm {
|
||||
invalidNamePattern(wellNamePattern, parseContext, errors, keyword);
|
||||
|
||||
for (const auto& well_name : well_names) {
|
||||
auto& dynamic_state = this->wells_static.at(well_name);
|
||||
const auto& dynamic_state = this->wells_static.at(well_name);
|
||||
auto well2 = std::make_shared<Well2>(*dynamic_state[currentStep]);
|
||||
auto foam_properties = std::make_shared<WellFoamProperties>(well2->getFoamProperties());
|
||||
foam_properties->handleWFOAM(record);
|
||||
@@ -974,7 +974,7 @@ namespace Opm {
|
||||
|
||||
for( const auto& well_name : well_names) {
|
||||
{
|
||||
auto& dynamic_state = this->wells_static.at(well_name);
|
||||
const auto& dynamic_state = this->wells_static.at(well_name);
|
||||
auto well2 = std::make_shared<Well2>(*dynamic_state[currentStep]);
|
||||
auto polymer_properties = std::make_shared<WellPolymerProperties>( well2->getPolymerProperties() );
|
||||
polymer_properties->handleWPOLYMER(record);
|
||||
|
||||
@@ -136,9 +136,12 @@ bool Well2::updateWellGuideRate(double guide_rate_arg) {
|
||||
|
||||
|
||||
bool Well2::updateFoamProperties(std::shared_ptr<WellFoamProperties> foam_properties_arg) {
|
||||
if (this->producer) {
|
||||
throw std::runtime_error("Not allowed to set foam injection properties for well " + name()
|
||||
+ " since it is a production well");
|
||||
}
|
||||
if (*this->foam_properties != *foam_properties_arg) {
|
||||
this->foam_properties = foam_properties_arg;
|
||||
this->producer = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -147,9 +150,12 @@ bool Well2::updateFoamProperties(std::shared_ptr<WellFoamProperties> foam_proper
|
||||
|
||||
|
||||
bool Well2::updatePolymerProperties(std::shared_ptr<WellPolymerProperties> polymer_properties_arg) {
|
||||
if (this->producer) {
|
||||
throw std::runtime_error("Not allowed to set polymer injection properties for well " + name() +
|
||||
" since it is a production well");
|
||||
}
|
||||
if (*this->polymer_properties != *polymer_properties_arg) {
|
||||
this->polymer_properties = polymer_properties_arg;
|
||||
this->producer = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -3002,6 +3002,9 @@ BOOST_AUTO_TEST_CASE(POLYINJ_TEST) {
|
||||
"WELSPECS\n"
|
||||
"'INJE01' 'I' 1 1 1 'WATER' /\n"
|
||||
"/\n"
|
||||
"WCONINJE\n"
|
||||
"'INJE01' 'WATER' 'OPEN' 'RATE' 800.00 1* 1000 /\n"
|
||||
"/\n"
|
||||
"TSTEP\n"
|
||||
" 1/\n"
|
||||
"WPOLYMER\n"
|
||||
@@ -3066,6 +3069,9 @@ BOOST_AUTO_TEST_CASE(WFOAM_TEST) {
|
||||
"WELSPECS\n"
|
||||
"'INJE01' 'I' 1 1 1 'WATER' /\n"
|
||||
"/\n"
|
||||
"WCONINJE\n"
|
||||
"'INJE01' 'GAS' 'OPEN' 'RATE' 80000.00 1* 1000 /\n"
|
||||
"/\n"
|
||||
"TSTEP\n"
|
||||
" 1/\n"
|
||||
"WFOAM\n"
|
||||
|
||||
@@ -721,10 +721,6 @@ COMPDAT
|
||||
W_6 0 0 2 2 2* 1* 2* 0.7 / -- Active index: 2
|
||||
/
|
||||
|
||||
WPOLYMER
|
||||
'W_3' 1.5 1.0 /
|
||||
/
|
||||
|
||||
WCONHIST
|
||||
-- history rates are set so that W_1 produces 1, W_2 produces 2 etc.
|
||||
-- index.offset.
|
||||
@@ -738,6 +734,9 @@ WCONINJH
|
||||
W_3 WATER STOP 30.0 2.1 2.2 /
|
||||
/
|
||||
|
||||
WPOLYMER
|
||||
'W_3' 1.5 1.0 /
|
||||
/
|
||||
WCONINJH
|
||||
-- Injection historical rates (water only, as we only support pure injectors)
|
||||
W_6 GAS STOP 30000.0 /
|
||||
|
||||
Reference in New Issue
Block a user