Files
opm-common/opm/parser/eclipse/EclipseState/Schedule/WellProductionProperties.cpp
Joakim Hove 61cdf7d402 Default: defaultApplied -> setInDeck()
The data values in a deck item can be in three different states, given
by the DeckValue enum in DeckItem.hpp. The three values are:

  SET_IN_DECK : The value has been set explictly in the deck.
  DEFAULT     : The value was not present in the input deck, but a default
                value has been supplied in the configuration and that value
                has been set.
  NOT_SET     : No value has been set for this item; it was not explicitly
                set in the deck and also not included in the configuration.

If you ask for DeckItem->value which is in state NOT_SET you will get an
exception. The method setInDeck() can be used to check if a value has
been set explicitly in the deck; the method defaultApplied() will check
if a default value has been applied.

Observe that the system for handling defaults is not really well suited
for multi valued data items, as it is only a scalar state variable. In
the case of multi valued data items both defaultApplied() and
setInDeck() might return true.
2014-09-03 10:37:01 +02:00

109 lines
3.1 KiB
C++

#include <opm/parser/eclipse/EclipseState/Schedule/WellProductionProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <string>
#include <vector>
namespace Opm {
WellProductionProperties::
WellProductionProperties()
{
init();
predictionMode = true;
}
WellProductionProperties::
WellProductionProperties(DeckRecordConstPtr record)
{
init();
WaterRate = record->getItem("WRAT")->getSIDouble(0);
OilRate = record->getItem("ORAT")->getSIDouble(0);
GasRate = record->getItem("GRAT")->getSIDouble(0);
}
WellProductionProperties
WellProductionProperties::history(DeckRecordConstPtr record)
{
WellProductionProperties p(record);
p.predictionMode = false;
// 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.
const std::vector<std::string> controlModes{
"ORAT", "WRAT", "GRAT", "LRAT", "RESV"
};
for (std::vector<std::string>::const_iterator
mode = controlModes.begin(), end = controlModes.end();
mode != end; ++mode)
{
const WellProducer::ControlModeEnum cmode =
WellProducer::ControlModeFromString(*mode);
p.addProductionControl(cmode);
}
// BHP control must be explictly provided.
if (record->getItem("BHP")->setInDeck()) {
p.addProductionControl(WellProducer::BHP);
}
return p;
}
WellProductionProperties
WellProductionProperties::prediction(DeckRecordConstPtr record)
{
WellProductionProperties p(record);
p.predictionMode = true;
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);
const std::vector<std::string> controlModes{
"ORAT", "WRAT", "GRAT", "LRAT",
"RESV", "BHP" , "THP"
};
for (std::vector<std::string>::const_iterator
mode = controlModes.begin(), end = controlModes.end();
mode != end; ++mode)
{
if (record->getItem(*mode)->setInDeck()) {
const WellProducer::ControlModeEnum cmode =
WellProducer::ControlModeFromString(*mode);
p.addProductionControl(cmode);
}
}
return p;
}
void
WellProductionProperties::init()
{
// public: properties (in order of declaration)
OilRate = 0.0;
GasRate = 0.0;
WaterRate = 0.0;
LiquidRate = 0.0;
ResVRate = 0.0;
BHPLimit = 0.0;
THPLimit = 0.0;
controlMode = WellProducer::ORAT;
// private: property
productionControls = 0;
}
} // namespace Opm