Files
opm-common/opm/parser/eclipse/EclipseState/Schedule/WellProductionProperties.hpp
Bård Skaflestad ef5a9e8e1a 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-08 13:22:46 +02:00

80 lines
2.3 KiB
C++

/*
Copyright 2013 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/>.
*/
#ifndef WELLPRODUCTIONPROPERTIES_HPP_HEADER_INCLUDED
#define WELLPRODUCTIONPROPERTIES_HPP_HEADER_INCLUDED
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
namespace Opm {
struct WellProductionProperties {
double OilRate;
double GasRate;
double WaterRate;
double LiquidRate;
double ResVRate;
double BHPLimit;
double THPLimit;
bool predictionMode;
WellProducer::ControlModeEnum controlMode;
WellProductionProperties();
static WellProductionProperties
history(DeckRecordConstPtr record);
static WellProductionProperties
prediction(DeckRecordConstPtr record);
bool
hasProductionControl(WellProducer::ControlModeEnum controlModeArg) const
{
return (productionControls & controlModeArg) != 0;
}
void
dropProductionControl(WellProducer::ControlModeEnum controlModeArg)
{
if (hasProductionControl(controlModeArg)) {
productionControls -= controlModeArg;
}
}
void
addProductionControl(WellProducer::ControlModeEnum controlModeArg)
{
if (! hasProductionControl(controlModeArg)) {
productionControls += controlModeArg;
}
}
private:
int productionControls;
WellProductionProperties(DeckRecordConstPtr record);
void
init();
};
} // namespace Opm
#endif // WELLPRODUCTIONPROPERTIES_HPP_HEADER_INCLUDED