2016-03-04 14:56:18 +01:00
|
|
|
/*
|
|
|
|
|
Copyright 2016 Statoil ASA.
|
|
|
|
|
|
|
|
|
|
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 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/>.
|
|
|
|
|
*/
|
Refactor WellProductionProperties manipulation code
This commit splits the creation of WellProductionProperties objects,
and especially the ad-hoc helper functions historyProperties()
and predictionProperties() out to a separate module,
WellProductionProperties.[hc]pp. Creating the properties object
from a DeckRecordConstPtr is deferred to two named constructors,
WellProductionProperties::history() and
WellProductionProperties::prediction()
that, respectively, assume the roles of historyProperties() and
predictionProperties(). Reimplement handleWCONProducer() in terms
of these named constructors and remove the producerProperties()
helper whose task, inspecting the status and retrieving/setting the
CMODE if not SHUT, can be assumed by handleWCONProducer().
Add a simple test module, WellPropertiesTest.cpp, to enforce the
rather peculiar semantics of the WCONHIST keyword. Control modes
{O,W,G}RAT, LRAT, and RESV are *always* (unconditionally) supported
in WCONHIST but there is no control mode switching. The latter is
deferred to client code, depending on the '.predictionMode' flag.
Suggested by: [at] joakim-hove
2014-07-07 13:28:25 +02:00
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2016-01-24 21:49:39 +01:00
|
|
|
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
|
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/WellProductionProperties.hpp>
|
|
|
|
|
|
|
|
|
|
|
Refactor WellProductionProperties manipulation code
This commit splits the creation of WellProductionProperties objects,
and especially the ad-hoc helper functions historyProperties()
and predictionProperties() out to a separate module,
WellProductionProperties.[hc]pp. Creating the properties object
from a DeckRecordConstPtr is deferred to two named constructors,
WellProductionProperties::history() and
WellProductionProperties::prediction()
that, respectively, assume the roles of historyProperties() and
predictionProperties(). Reimplement handleWCONProducer() in terms
of these named constructors and remove the producerProperties()
helper whose task, inspecting the status and retrieving/setting the
CMODE if not SHUT, can be assumed by handleWCONProducer().
Add a simple test module, WellPropertiesTest.cpp, to enforce the
rather peculiar semantics of the WCONHIST keyword. Control modes
{O,W,G}RAT, LRAT, and RESV are *always* (unconditionally) supported
in WCONHIST but there is no control mode switching. The latter is
deferred to client code, depending on the '.predictionMode' flag.
Suggested by: [at] joakim-hove
2014-07-07 13:28:25 +02:00
|
|
|
namespace Opm {
|
2016-02-09 12:09:40 +01:00
|
|
|
|
Refactor WellProductionProperties manipulation code
This commit splits the creation of WellProductionProperties objects,
and especially the ad-hoc helper functions historyProperties()
and predictionProperties() out to a separate module,
WellProductionProperties.[hc]pp. Creating the properties object
from a DeckRecordConstPtr is deferred to two named constructors,
WellProductionProperties::history() and
WellProductionProperties::prediction()
that, respectively, assume the roles of historyProperties() and
predictionProperties(). Reimplement handleWCONProducer() in terms
of these named constructors and remove the producerProperties()
helper whose task, inspecting the status and retrieving/setting the
CMODE if not SHUT, can be assumed by handleWCONProducer().
Add a simple test module, WellPropertiesTest.cpp, to enforce the
rather peculiar semantics of the WCONHIST keyword. Control modes
{O,W,G}RAT, LRAT, and RESV are *always* (unconditionally) supported
in WCONHIST but there is no control mode switching. The latter is
deferred to client code, depending on the '.predictionMode' flag.
Suggested by: [at] joakim-hove
2014-07-07 13:28:25 +02:00
|
|
|
WellProductionProperties::
|
2016-02-09 12:09:40 +01:00
|
|
|
WellProductionProperties() : predictionMode( true )
|
|
|
|
|
{}
|
Refactor WellProductionProperties manipulation code
This commit splits the creation of WellProductionProperties objects,
and especially the ad-hoc helper functions historyProperties()
and predictionProperties() out to a separate module,
WellProductionProperties.[hc]pp. Creating the properties object
from a DeckRecordConstPtr is deferred to two named constructors,
WellProductionProperties::history() and
WellProductionProperties::prediction()
that, respectively, assume the roles of historyProperties() and
predictionProperties(). Reimplement handleWCONProducer() in terms
of these named constructors and remove the producerProperties()
helper whose task, inspecting the status and retrieving/setting the
CMODE if not SHUT, can be assumed by handleWCONProducer().
Add a simple test module, WellPropertiesTest.cpp, to enforce the
rather peculiar semantics of the WCONHIST keyword. Control modes
{O,W,G}RAT, LRAT, and RESV are *always* (unconditionally) supported
in WCONHIST but there is no control mode switching. The latter is
deferred to client code, depending on the '.predictionMode' flag.
Suggested by: [at] joakim-hove
2014-07-07 13:28:25 +02:00
|
|
|
|
|
|
|
|
WellProductionProperties::
|
2016-02-09 12:09:40 +01:00
|
|
|
WellProductionProperties( const DeckRecord& record ) :
|
|
|
|
|
OilRate( record.getItem( "ORAT" ).getSIDouble( 0 ) ),
|
|
|
|
|
WaterRate( record.getItem( "WRAT" ).getSIDouble( 0 ) ),
|
|
|
|
|
GasRate( record.getItem( "GRAT" ).getSIDouble( 0 ) )
|
|
|
|
|
{}
|
Refactor WellProductionProperties manipulation code
This commit splits the creation of WellProductionProperties objects,
and especially the ad-hoc helper functions historyProperties()
and predictionProperties() out to a separate module,
WellProductionProperties.[hc]pp. Creating the properties object
from a DeckRecordConstPtr is deferred to two named constructors,
WellProductionProperties::history() and
WellProductionProperties::prediction()
that, respectively, assume the roles of historyProperties() and
predictionProperties(). Reimplement handleWCONProducer() in terms
of these named constructors and remove the producerProperties()
helper whose task, inspecting the status and retrieving/setting the
CMODE if not SHUT, can be assumed by handleWCONProducer().
Add a simple test module, WellPropertiesTest.cpp, to enforce the
rather peculiar semantics of the WCONHIST keyword. Control modes
{O,W,G}RAT, LRAT, and RESV are *always* (unconditionally) supported
in WCONHIST but there is no control mode switching. The latter is
deferred to client code, depending on the '.predictionMode' flag.
Suggested by: [at] joakim-hove
2014-07-07 13:28:25 +02:00
|
|
|
|
|
|
|
|
|
2016-02-09 12:09:40 +01:00
|
|
|
WellProductionProperties WellProductionProperties::history(double BHPLimit, const DeckRecord& record)
|
2015-10-27 14:12:28 +01:00
|
|
|
{
|
Refactor WellProductionProperties manipulation code
This commit splits the creation of WellProductionProperties objects,
and especially the ad-hoc helper functions historyProperties()
and predictionProperties() out to a separate module,
WellProductionProperties.[hc]pp. Creating the properties object
from a DeckRecordConstPtr is deferred to two named constructors,
WellProductionProperties::history() and
WellProductionProperties::prediction()
that, respectively, assume the roles of historyProperties() and
predictionProperties(). Reimplement handleWCONProducer() in terms
of these named constructors and remove the producerProperties()
helper whose task, inspecting the status and retrieving/setting the
CMODE if not SHUT, can be assumed by handleWCONProducer().
Add a simple test module, WellPropertiesTest.cpp, to enforce the
rather peculiar semantics of the WCONHIST keyword. Control modes
{O,W,G}RAT, LRAT, and RESV are *always* (unconditionally) supported
in WCONHIST but there is no control mode switching. The latter is
deferred to client code, depending on the '.predictionMode' flag.
Suggested by: [at] joakim-hove
2014-07-07 13:28:25 +02:00
|
|
|
// Modes supported in WCONHIST just from {O,W,G}RAT values
|
|
|
|
|
//
|
|
|
|
|
// Note: The default value of observed {O,W,G}RAT is zero
|
|
|
|
|
// (numerically) whence the following control modes are
|
|
|
|
|
// unconditionally supported.
|
2015-10-27 14:12:28 +01:00
|
|
|
WellProductionProperties p(record);
|
|
|
|
|
p.predictionMode = false;
|
2016-01-19 13:35:07 +01:00
|
|
|
|
|
|
|
|
for (auto const& modeKey : {"ORAT", "WRAT", "GRAT", "LRAT", "RESV", "GRUP"}) {
|
|
|
|
|
auto cmode = WellProducer::ControlModeFromString( modeKey );
|
|
|
|
|
p.addProductionControl( cmode );
|
Refactor WellProductionProperties manipulation code
This commit splits the creation of WellProductionProperties objects,
and especially the ad-hoc helper functions historyProperties()
and predictionProperties() out to a separate module,
WellProductionProperties.[hc]pp. Creating the properties object
from a DeckRecordConstPtr is deferred to two named constructors,
WellProductionProperties::history() and
WellProductionProperties::prediction()
that, respectively, assume the roles of historyProperties() and
predictionProperties(). Reimplement handleWCONProducer() in terms
of these named constructors and remove the producerProperties()
helper whose task, inspecting the status and retrieving/setting the
CMODE if not SHUT, can be assumed by handleWCONProducer().
Add a simple test module, WellPropertiesTest.cpp, to enforce the
rather peculiar semantics of the WCONHIST keyword. Control modes
{O,W,G}RAT, LRAT, and RESV are *always* (unconditionally) supported
in WCONHIST but there is no control mode switching. The latter is
deferred to client code, depending on the '.predictionMode' flag.
Suggested by: [at] joakim-hove
2014-07-07 13:28:25 +02:00
|
|
|
}
|
|
|
|
|
|
2015-10-27 14:12:28 +01:00
|
|
|
/*
|
|
|
|
|
We do not update the BHPLIMIT based on the BHP value given
|
|
|
|
|
in WCONHIST, that is purely a historical value; instead we
|
|
|
|
|
copy the old value of the BHP limit from the previous
|
|
|
|
|
timestep.
|
2014-12-08 16:34:28 +01:00
|
|
|
|
2015-10-27 14:12:28 +01:00
|
|
|
To actually set the BHPLIMIT in historical mode you must
|
|
|
|
|
use the WELTARG keyword.
|
|
|
|
|
*/
|
|
|
|
|
p.BHPLimit = BHPLimit;
|
2014-12-08 16:34:28 +01:00
|
|
|
|
2016-02-09 12:09:40 +01:00
|
|
|
const auto& cmodeItem = record.getItem("CMODE");
|
|
|
|
|
if (!cmodeItem.defaultApplied(0)) {
|
|
|
|
|
const WellProducer::ControlModeEnum cmode = WellProducer::ControlModeFromString( cmodeItem.get< std::string >(0) );
|
|
|
|
|
|
|
|
|
|
if (p.hasProductionControl( cmode ))
|
|
|
|
|
p.controlMode = cmode;
|
|
|
|
|
else
|
|
|
|
|
throw std::invalid_argument("Setting CMODE to unspecified control");
|
2014-10-13 19:26:53 +02:00
|
|
|
}
|
2016-02-09 12:09:40 +01:00
|
|
|
|
Refactor WellProductionProperties manipulation code
This commit splits the creation of WellProductionProperties objects,
and especially the ad-hoc helper functions historyProperties()
and predictionProperties() out to a separate module,
WellProductionProperties.[hc]pp. Creating the properties object
from a DeckRecordConstPtr is deferred to two named constructors,
WellProductionProperties::history() and
WellProductionProperties::prediction()
that, respectively, assume the roles of historyProperties() and
predictionProperties(). Reimplement handleWCONProducer() in terms
of these named constructors and remove the producerProperties()
helper whose task, inspecting the status and retrieving/setting the
CMODE if not SHUT, can be assumed by handleWCONProducer().
Add a simple test module, WellPropertiesTest.cpp, to enforce the
rather peculiar semantics of the WCONHIST keyword. Control modes
{O,W,G}RAT, LRAT, and RESV are *always* (unconditionally) supported
in WCONHIST but there is no control mode switching. The latter is
deferred to client code, depending on the '.predictionMode' flag.
Suggested by: [at] joakim-hove
2014-07-07 13:28:25 +02:00
|
|
|
return p;
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-27 14:12:28 +01:00
|
|
|
|
|
|
|
|
|
2016-02-09 12:09:40 +01:00
|
|
|
WellProductionProperties WellProductionProperties::prediction( const DeckRecord& record, bool addGroupProductionControl)
|
Refactor WellProductionProperties manipulation code
This commit splits the creation of WellProductionProperties objects,
and especially the ad-hoc helper functions historyProperties()
and predictionProperties() out to a separate module,
WellProductionProperties.[hc]pp. Creating the properties object
from a DeckRecordConstPtr is deferred to two named constructors,
WellProductionProperties::history() and
WellProductionProperties::prediction()
that, respectively, assume the roles of historyProperties() and
predictionProperties(). Reimplement handleWCONProducer() in terms
of these named constructors and remove the producerProperties()
helper whose task, inspecting the status and retrieving/setting the
CMODE if not SHUT, can be assumed by handleWCONProducer().
Add a simple test module, WellPropertiesTest.cpp, to enforce the
rather peculiar semantics of the WCONHIST keyword. Control modes
{O,W,G}RAT, LRAT, and RESV are *always* (unconditionally) supported
in WCONHIST but there is no control mode switching. The latter is
deferred to client code, depending on the '.predictionMode' flag.
Suggested by: [at] joakim-hove
2014-07-07 13:28:25 +02:00
|
|
|
{
|
|
|
|
|
WellProductionProperties p(record);
|
|
|
|
|
p.predictionMode = true;
|
|
|
|
|
|
2016-02-09 12:09:40 +01:00
|
|
|
p.LiquidRate = record.getItem("LRAT" ).getSIDouble(0);
|
|
|
|
|
p.ResVRate = record.getItem("RESV" ).getSIDouble(0);
|
|
|
|
|
p.BHPLimit = record.getItem("BHP" ).getSIDouble(0);
|
|
|
|
|
p.THPLimit = record.getItem("THP" ).getSIDouble(0);
|
|
|
|
|
p.ALQValue = record.getItem("ALQ" ).get< double >(0); //NOTE: Unit of ALQ is never touched
|
|
|
|
|
p.VFPTableNumber = record.getItem("VFP_TABLE").get< int >(0);
|
Refactor WellProductionProperties manipulation code
This commit splits the creation of WellProductionProperties objects,
and especially the ad-hoc helper functions historyProperties()
and predictionProperties() out to a separate module,
WellProductionProperties.[hc]pp. Creating the properties object
from a DeckRecordConstPtr is deferred to two named constructors,
WellProductionProperties::history() and
WellProductionProperties::prediction()
that, respectively, assume the roles of historyProperties() and
predictionProperties(). Reimplement handleWCONProducer() in terms
of these named constructors and remove the producerProperties()
helper whose task, inspecting the status and retrieving/setting the
CMODE if not SHUT, can be assumed by handleWCONProducer().
Add a simple test module, WellPropertiesTest.cpp, to enforce the
rather peculiar semantics of the WCONHIST keyword. Control modes
{O,W,G}RAT, LRAT, and RESV are *always* (unconditionally) supported
in WCONHIST but there is no control mode switching. The latter is
deferred to client code, depending on the '.predictionMode' flag.
Suggested by: [at] joakim-hove
2014-07-07 13:28:25 +02:00
|
|
|
|
2016-01-19 13:35:07 +01:00
|
|
|
for (auto const& modeKey : {"ORAT", "WRAT", "GRAT", "LRAT","RESV", "BHP" , "THP"}) {
|
2016-02-09 12:09:40 +01:00
|
|
|
if (!record.getItem(modeKey).defaultApplied(0)) {
|
2016-01-19 13:35:07 +01:00
|
|
|
auto cmode = WellProducer::ControlModeFromString( modeKey );
|
|
|
|
|
p.addProductionControl( cmode );
|
Refactor WellProductionProperties manipulation code
This commit splits the creation of WellProductionProperties objects,
and especially the ad-hoc helper functions historyProperties()
and predictionProperties() out to a separate module,
WellProductionProperties.[hc]pp. Creating the properties object
from a DeckRecordConstPtr is deferred to two named constructors,
WellProductionProperties::history() and
WellProductionProperties::prediction()
that, respectively, assume the roles of historyProperties() and
predictionProperties(). Reimplement handleWCONProducer() in terms
of these named constructors and remove the producerProperties()
helper whose task, inspecting the status and retrieving/setting the
CMODE if not SHUT, can be assumed by handleWCONProducer().
Add a simple test module, WellPropertiesTest.cpp, to enforce the
rather peculiar semantics of the WCONHIST keyword. Control modes
{O,W,G}RAT, LRAT, and RESV are *always* (unconditionally) supported
in WCONHIST but there is no control mode switching. The latter is
deferred to client code, depending on the '.predictionMode' flag.
Suggested by: [at] joakim-hove
2014-07-07 13:28:25 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-19 13:35:07 +01:00
|
|
|
if (addGroupProductionControl) {
|
|
|
|
|
p.addProductionControl(WellProducer::GRUP);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2014-10-13 19:26:53 +02:00
|
|
|
{
|
2016-02-09 12:09:40 +01:00
|
|
|
const auto& cmodeItem = record.getItem("CMODE");
|
|
|
|
|
if (cmodeItem.hasValue(0)) {
|
|
|
|
|
const WellProducer::ControlModeEnum cmode = WellProducer::ControlModeFromString( cmodeItem.get< std::string >(0) );
|
2014-12-08 16:34:28 +01:00
|
|
|
|
2014-10-13 19:26:53 +02:00
|
|
|
if (p.hasProductionControl( cmode ))
|
|
|
|
|
p.controlMode = cmode;
|
2014-12-08 16:34:28 +01:00
|
|
|
else
|
2014-10-13 19:26:53 +02:00
|
|
|
throw std::invalid_argument("Setting CMODE to unspecified control");
|
|
|
|
|
}
|
|
|
|
|
}
|
Refactor WellProductionProperties manipulation code
This commit splits the creation of WellProductionProperties objects,
and especially the ad-hoc helper functions historyProperties()
and predictionProperties() out to a separate module,
WellProductionProperties.[hc]pp. Creating the properties object
from a DeckRecordConstPtr is deferred to two named constructors,
WellProductionProperties::history() and
WellProductionProperties::prediction()
that, respectively, assume the roles of historyProperties() and
predictionProperties(). Reimplement handleWCONProducer() in terms
of these named constructors and remove the producerProperties()
helper whose task, inspecting the status and retrieving/setting the
CMODE if not SHUT, can be assumed by handleWCONProducer().
Add a simple test module, WellPropertiesTest.cpp, to enforce the
rather peculiar semantics of the WCONHIST keyword. Control modes
{O,W,G}RAT, LRAT, and RESV are *always* (unconditionally) supported
in WCONHIST but there is no control mode switching. The latter is
deferred to client code, depending on the '.predictionMode' flag.
Suggested by: [at] joakim-hove
2014-07-07 13:28:25 +02:00
|
|
|
return p;
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-27 14:12:28 +01:00
|
|
|
|
2015-06-23 09:22:39 +02:00
|
|
|
bool WellProductionProperties::operator==(const WellProductionProperties& other) const {
|
|
|
|
|
if ((OilRate == other.OilRate) &&
|
|
|
|
|
(WaterRate == other.WaterRate) &&
|
|
|
|
|
(GasRate == other.GasRate) &&
|
|
|
|
|
(LiquidRate == other.LiquidRate) &&
|
|
|
|
|
(ResVRate == other.ResVRate) &&
|
|
|
|
|
(BHPLimit == other.BHPLimit) &&
|
|
|
|
|
(THPLimit == other.THPLimit) &&
|
|
|
|
|
(VFPTableNumber == other.VFPTableNumber) &&
|
|
|
|
|
(controlMode == other.controlMode) &&
|
|
|
|
|
(m_productionControls == other.m_productionControls))
|
|
|
|
|
return true;
|
|
|
|
|
else
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool WellProductionProperties::operator!=(const WellProductionProperties& other) const {
|
|
|
|
|
return !(*this == other);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
Refactor WellProductionProperties manipulation code
This commit splits the creation of WellProductionProperties objects,
and especially the ad-hoc helper functions historyProperties()
and predictionProperties() out to a separate module,
WellProductionProperties.[hc]pp. Creating the properties object
from a DeckRecordConstPtr is deferred to two named constructors,
WellProductionProperties::history() and
WellProductionProperties::prediction()
that, respectively, assume the roles of historyProperties() and
predictionProperties(). Reimplement handleWCONProducer() in terms
of these named constructors and remove the producerProperties()
helper whose task, inspecting the status and retrieving/setting the
CMODE if not SHUT, can be assumed by handleWCONProducer().
Add a simple test module, WellPropertiesTest.cpp, to enforce the
rather peculiar semantics of the WCONHIST keyword. Control modes
{O,W,G}RAT, LRAT, and RESV are *always* (unconditionally) supported
in WCONHIST but there is no control mode switching. The latter is
deferred to client code, depending on the '.predictionMode' flag.
Suggested by: [at] joakim-hove
2014-07-07 13:28:25 +02:00
|
|
|
} // namespace Opm
|