Merge pull request #1913 from joakim-hove/first-production

First production
This commit is contained in:
Bård Skaflestad 2020-09-09 16:15:58 +02:00 committed by GitHub
commit eb5787fd54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 100 additions and 3 deletions

View File

@ -21,8 +21,8 @@
#ifndef WELL2_HPP
#define WELL2_HPP
#include <string>
#include <iosfwd>
#include <string>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
@ -558,7 +558,8 @@ public:
bool segmented_density_calculation() const { return true; }
double alq_value() const;
double temperature() const;
bool hasProduced( ) const;
bool updateHasProduced();
bool cmp_structure(const Well& other) const;
bool operator==(const Well& data) const;
void setInsertIndex(std::size_t index);
@ -585,6 +586,7 @@ public:
guide_rate.serializeOp(serializer);
serializer(efficiency_factor);
serializer(solvent_fraction);
serializer(has_produced);
serializer(prediction_mode);
serializer(econ_limits);
serializer(foam_properties);
@ -620,6 +622,7 @@ private:
WellGuideRate guide_rate;
double efficiency_factor;
double solvent_fraction;
bool has_produced = false;
bool prediction_mode = true;

View File

@ -951,6 +951,9 @@ Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext&
if (well2->updatePrediction(false))
update_well = true;
if (well2->updateHasProduced())
update_well = true;
if (update_well) {
m_events.addEvent( ScheduleEvents::PRODUCTION_UPDATE , currentStep);
this->addWellGroupEvent( well2->name(), ScheduleEvents::PRODUCTION_UPDATE, currentStep);
@ -1010,6 +1013,9 @@ Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext&
if (well2->updatePrediction(true))
update_well = true;
if (well2->updateHasProduced())
update_well = true;
if (update_well) {
m_events.addEvent( ScheduleEvents::PRODUCTION_UPDATE , currentStep);
this->addWellGroupEvent( well2->name(), ScheduleEvents::PRODUCTION_UPDATE, currentStep);

View File

@ -469,6 +469,18 @@ bool Well::updateInjection(std::shared_ptr<WellInjectionProperties> injection_ar
return false;
}
bool Well::updateHasProduced() {
if (this->wtype.producer() && this->status == Status::OPEN) {
if (this->has_produced)
return false;
this->has_produced = true;
return true;
}
return false;
}
bool Well::updateProduction(std::shared_ptr<WellProductionProperties> production_arg) {
if (!this->wtype.producer())
this->switchToProducer( );
@ -1082,6 +1094,10 @@ bool Well::predictionMode() const {
return this->prediction_mode;
}
bool Well::hasProduced( ) const {
return this->has_produced;
}
bool Well::updatePrediction(bool prediction_mode_arg) {
if (this->prediction_mode != prediction_mode_arg) {
@ -1258,7 +1274,7 @@ Well::InjectorCMode Well::InjectorCModeFromString(const std::string &stringValue
else if (stringValue == "GRUP")
return InjectorCMode::GRUP;
else
throw std::invalid_argument("Unknown enum state string: " + stringValue);
throw std::invalid_argument("Unknown control mode string: " + stringValue);
}
std::ostream& operator<<(std::ostream& os, const Well::InjectorCMode& cm) {

View File

@ -1220,3 +1220,75 @@ WPIMULT
}
BOOST_AUTO_TEST_CASE(FIRST_OPEN) {
Opm::Parser parser;
std::string input = R"(
START -- 0
19 JUN 2007 /
REGIONS
PVTNUM
1000*77 /
SCHEDULE
WELSPECS
'P' 'OP' 9 9 1* 'OIL' 1* 1* 1* 1* 1* 1* 1* /
'I' 'OP' 9 9 1* 'OIL' 1* 1* 1* 1* 66 /
/
COMPDAT
'P' 9 9 2 2 'OPEN' 1* 2.0 0.311 3047.839 1* 1* 'X' 22.100 /
'I' 9 9 3 3 'OPEN' 1* 3.0 0.311 4332.346 1* 1* 'X' 22.123 /
/
DATES -- 1
20 JAN 2010 /
/
DATES -- 2
20 FEB 2010 /
/
WCONPROD
'P' 'OPEN' 'BHP' 1 2 3 2* 20. 10. 8 13 /
/
WCONINJE
'I' 'GAS' 'OPEN' 'RATE' 1000 /
/
)";
auto deck = parser.parseString(input);
const auto& units = deck.getActiveUnitSystem();
auto python = std::make_shared<Opm::Python>();
Opm::EclipseGrid grid(10,10,10);
TableManager table ( deck );
FieldPropsManager fp(deck, Phases{true, true, true}, grid, table);
Opm::Runspec runspec (deck);
Opm::Schedule schedule(deck, grid , fp, runspec, python);
{
const auto& iwell = schedule.getWell("I", 0);
const auto& pwell = schedule.getWell("P", 0);
BOOST_CHECK( iwell.getStatus() == Well::Status::SHUT );
BOOST_CHECK( pwell.getStatus() == Well::Status::SHUT );
BOOST_CHECK( !iwell.hasProduced() );
BOOST_CHECK( !pwell.hasProduced() );
}
{
const auto& iwell = schedule.getWell("I", 2);
const auto& pwell = schedule.getWell("P", 2);
BOOST_CHECK( iwell.getStatus() == Well::Status::OPEN );
BOOST_CHECK( pwell.getStatus() == Well::Status::OPEN );
BOOST_CHECK( !iwell.hasProduced() );
BOOST_CHECK( pwell.hasProduced() );
}
}