The WELTARG treatment is moved out from Schedule.cpp
This commit is contained in:
parent
d5ce2b6a76
commit
164ab30fa1
@ -69,6 +69,31 @@ namespace Opm {
|
||||
|
||||
}
|
||||
|
||||
namespace WellTarget {
|
||||
enum ControlModeEnum {
|
||||
ORAT = 1,
|
||||
WRAT = 2,
|
||||
GRAT = 3,
|
||||
LRAT = 4,
|
||||
CRAT = 5, // Not supported
|
||||
RESV = 6,
|
||||
BHP = 7,
|
||||
THP = 8,
|
||||
VFP = 9,
|
||||
LIFT = 10, // Not supported
|
||||
GUID = 11
|
||||
};
|
||||
/*
|
||||
There are unfortuntaley separate enums for production controls,
|
||||
injection controls and also for WELTARG control arguments. Since the
|
||||
WELTARG control arguments are *not* used to enumerate available
|
||||
controls the numerical values are - conciously - not in 2^n range.
|
||||
*/
|
||||
|
||||
ControlModeEnum ControlModeFromString(const std::string& string_value);
|
||||
}
|
||||
|
||||
|
||||
namespace WellInjector {
|
||||
enum TypeEnum {
|
||||
WATER = 1,
|
||||
|
@ -47,6 +47,7 @@ namespace Opm {
|
||||
bool operator!=(const WellInjectionProperties& other) const;
|
||||
|
||||
WellInjectionProperties();
|
||||
void handleWELTARG(WellTarget::ControlModeEnum cmode, double newValue, double siFactorG, double siFactorL, double siFactorP);
|
||||
void handleWCONINJE(const DeckRecord& record, bool availableForGroupControl, const std::string& well_name, const UnitSystem& unit_system);
|
||||
void handleWCONINJH(const DeckRecord& record, bool is_producer, const std::string& well_name, const UnitSystem& unit_system);
|
||||
bool hasInjectionControl(WellInjector::ControlModeEnum controlModeArg) const {
|
||||
|
@ -73,6 +73,7 @@ namespace Opm {
|
||||
static bool effectiveHistoryProductionControl(const WellProducer::ControlModeEnum cmode);
|
||||
void handleWCONPROD( const DeckRecord& record);
|
||||
void handleWCONHIST( const DeckRecord& record);
|
||||
void handleWELTARG(WellTarget::ControlModeEnum cmode, double newValue, double siFactorG, double siFactorL, double siFactorP);
|
||||
void resetDefaultBHPLimit();
|
||||
|
||||
private:
|
||||
|
@ -1178,7 +1178,7 @@ namespace Opm {
|
||||
for( const auto& record : keyword ) {
|
||||
|
||||
const std::string& wellNamePattern = record.getItem("WELL").getTrimmedString(0);
|
||||
const std::string& cMode = record.getItem("CMODE").getTrimmedString(0);
|
||||
const auto cmode = WellTarget::ControlModeFromString(record.getItem("CMODE").getTrimmedString(0));
|
||||
double newValue = record.getItem("NEW_VALUE").get< double >(0);
|
||||
|
||||
const auto well_names = wellNames( wellNamePattern, currentStep );
|
||||
@ -1190,85 +1190,19 @@ namespace Opm {
|
||||
auto& well = this->m_wells.at(well_name);
|
||||
if(well.isProducer(currentStep)){
|
||||
WellProductionProperties prop = well.getProductionPropertiesCopy(currentStep);
|
||||
|
||||
if (cMode == "ORAT"){
|
||||
prop.OilRate = newValue * siFactorL;
|
||||
}
|
||||
else if (cMode == "WRAT"){
|
||||
prop.WaterRate = newValue * siFactorL;
|
||||
}
|
||||
else if (cMode == "GRAT"){
|
||||
prop.GasRate = newValue * siFactorG;
|
||||
}
|
||||
else if (cMode == "LRAT"){
|
||||
prop.LiquidRate = newValue * siFactorL;
|
||||
}
|
||||
else if (cMode == "RESV"){
|
||||
prop.ResVRate = newValue * siFactorL;
|
||||
}
|
||||
else if (cMode == "BHP"){
|
||||
prop.BHPLimit = newValue * siFactorP;
|
||||
}
|
||||
else if (cMode == "THP"){
|
||||
prop.THPLimit = newValue * siFactorP;
|
||||
}
|
||||
else if (cMode == "VFP"){
|
||||
prop.VFPTableNumber = static_cast<int> (newValue);
|
||||
}
|
||||
else if (cMode == "GUID"){
|
||||
prop.handleWELTARG(cmode, newValue, siFactorG, siFactorL, siFactorP);
|
||||
if (cmode == WellTarget::GUID)
|
||||
well.setGuideRate(currentStep, newValue);
|
||||
}
|
||||
else{
|
||||
throw std::invalid_argument("Invalid keyword (MODE) supplied");
|
||||
}
|
||||
|
||||
well.setProductionProperties(currentStep, prop);
|
||||
}else{
|
||||
} else {
|
||||
WellInjectionProperties prop = well.getInjectionPropertiesCopy(currentStep);
|
||||
if (cMode == "BHP"){
|
||||
prop.BHPLimit = newValue * siFactorP;
|
||||
}
|
||||
else if (cMode == "ORAT"){
|
||||
if(prop.injectorType == WellInjector::TypeEnum::OIL){
|
||||
prop.surfaceInjectionRate = newValue * siFactorL;
|
||||
}else{
|
||||
std::invalid_argument("Well type must be OIL to set the oil rate");
|
||||
}
|
||||
}
|
||||
else if (cMode == "WRAT"){
|
||||
if(prop.injectorType == WellInjector::TypeEnum::WATER){
|
||||
prop.surfaceInjectionRate = newValue * siFactorL;
|
||||
}else{
|
||||
std::invalid_argument("Well type must be WATER to set the water rate");
|
||||
}
|
||||
}
|
||||
else if (cMode == "GRAT"){
|
||||
if(prop.injectorType == WellInjector::TypeEnum::GAS){
|
||||
prop.surfaceInjectionRate = newValue * siFactorG;
|
||||
}else{
|
||||
std::invalid_argument("Well type must be GAS to set the gas rate");
|
||||
}
|
||||
}
|
||||
else if (cMode == "THP"){
|
||||
prop.THPLimit = newValue * siFactorP;
|
||||
}
|
||||
else if (cMode == "VFP"){
|
||||
prop.VFPTableNumber = static_cast<int> (newValue);
|
||||
}
|
||||
else if (cMode == "GUID"){
|
||||
prop.handleWELTARG(cmode, newValue, siFactorG, siFactorL, siFactorP);
|
||||
if (cmode == WellTarget::GUID)
|
||||
well.setGuideRate(currentStep, newValue);
|
||||
}
|
||||
else if (cMode == "RESV"){
|
||||
prop.reservoirInjectionRate = newValue * siFactorL;
|
||||
}
|
||||
else{
|
||||
throw std::invalid_argument("Invalid keyword (MODE) supplied");
|
||||
}
|
||||
|
||||
well.setInjectionProperties(currentStep, prop);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1614,10 +1548,9 @@ namespace Opm {
|
||||
|
||||
const std::string& wellNamePattern = record.getItem("WELL").getTrimmedString(0);
|
||||
const auto well_names = wellNames(wellNamePattern, currentStep);
|
||||
for(const auto& well_name : well_names) {
|
||||
auto& well = this->m_wells.at(well_name);
|
||||
for(const auto& well_name : well_names)
|
||||
this->rft_config.updateRFT(well_name, currentStep, RFTConnections::RFTEnum::YES);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this->rft_config.setWellOpenRFT(currentStep);
|
||||
|
@ -614,6 +614,48 @@ namespace Opm {
|
||||
}
|
||||
|
||||
|
||||
namespace WellTarget {
|
||||
|
||||
ControlModeEnum ControlModeFromString(const std::string& string_value) {
|
||||
if (string_value == "ORAT")
|
||||
return ORAT;
|
||||
|
||||
if (string_value == "WRAT")
|
||||
return WRAT;
|
||||
|
||||
if (string_value == "GRAT")
|
||||
return GRAT;
|
||||
|
||||
if (string_value == "LRAT")
|
||||
return LRAT;
|
||||
|
||||
if (string_value == "CRAT")
|
||||
return CRAT;
|
||||
|
||||
if (string_value == "RESV")
|
||||
return RESV;
|
||||
|
||||
if (string_value == "BHP")
|
||||
return BHP;
|
||||
|
||||
if (string_value == "THP")
|
||||
return THP;
|
||||
|
||||
if (string_value == "VFP")
|
||||
return VFP;
|
||||
|
||||
if (string_value == "LIFT")
|
||||
return LIFT;
|
||||
|
||||
if (string_value == "GUID")
|
||||
return GUID;
|
||||
|
||||
throw std::invalid_argument("WELTARG control mode: " + string_value + " not recognized.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
namespace WellEcon {
|
||||
const std::string WorkoverEnumToString(WorkoverEnum enumValue) {
|
||||
|
@ -102,6 +102,47 @@ namespace Opm {
|
||||
}
|
||||
|
||||
|
||||
|
||||
void WellInjectionProperties::handleWELTARG(WellTarget::ControlModeEnum cmode, double newValue, double siFactorG, double siFactorL, double siFactorP) {
|
||||
if (cmode == WellTarget::BHP){
|
||||
this->BHPLimit = newValue * siFactorP;
|
||||
}
|
||||
else if (cmode == WellTarget::ORAT){
|
||||
if(this->injectorType == WellInjector::TypeEnum::OIL){
|
||||
this->surfaceInjectionRate = newValue * siFactorL;
|
||||
}else{
|
||||
std::invalid_argument("Well type must be OIL to set the oil rate");
|
||||
}
|
||||
}
|
||||
else if (cmode == WellTarget::WRAT){
|
||||
if(this->injectorType == WellInjector::TypeEnum::WATER){
|
||||
this->surfaceInjectionRate = newValue * siFactorL;
|
||||
}else{
|
||||
std::invalid_argument("Well type must be WATER to set the water rate");
|
||||
}
|
||||
}
|
||||
else if (cmode == WellTarget::GRAT){
|
||||
if(this->injectorType == WellInjector::TypeEnum::GAS){
|
||||
this->surfaceInjectionRate = newValue * siFactorG;
|
||||
}else{
|
||||
std::invalid_argument("Well type must be GAS to set the gas rate");
|
||||
}
|
||||
}
|
||||
else if (cmode == WellTarget::THP){
|
||||
this->THPLimit = newValue * siFactorP;
|
||||
}
|
||||
else if (cmode == WellTarget::VFP){
|
||||
this->VFPTableNumber = static_cast<int> (newValue);
|
||||
}
|
||||
else if (cmode == WellTarget::RESV){
|
||||
this->reservoirInjectionRate = newValue * siFactorL;
|
||||
}
|
||||
else if (cmode != WellTarget::GUID){
|
||||
throw std::invalid_argument("Invalid keyword (MODE) supplied");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WellInjectionProperties::handleWCONINJH(const DeckRecord& record, bool is_producer, const std::string& well_name, const UnitSystem& unit_system) {
|
||||
// convert injection rates to SI
|
||||
const auto& typeItem = record.getItem("TYPE");
|
||||
|
@ -167,6 +167,37 @@ namespace Opm {
|
||||
|
||||
|
||||
|
||||
void WellProductionProperties::handleWELTARG(WellTarget::ControlModeEnum cmode, double newValue, double siFactorG, double siFactorL, double siFactorP) {
|
||||
if (cmode == WellTarget::ORAT){
|
||||
this->OilRate = newValue * siFactorL;
|
||||
}
|
||||
else if (cmode == WellTarget::WRAT){
|
||||
this->WaterRate = newValue * siFactorL;
|
||||
}
|
||||
else if (cmode == WellTarget::GRAT){
|
||||
this->GasRate = newValue * siFactorG;
|
||||
}
|
||||
else if (cmode == WellTarget::LRAT){
|
||||
this->LiquidRate = newValue * siFactorL;
|
||||
}
|
||||
else if (cmode == WellTarget::RESV){
|
||||
this->ResVRate = newValue * siFactorL;
|
||||
}
|
||||
else if (cmode == WellTarget::BHP){
|
||||
this->BHPLimit = newValue * siFactorP;
|
||||
}
|
||||
else if (cmode == WellTarget::THP){
|
||||
this->THPLimit = newValue * siFactorP;
|
||||
}
|
||||
else if (cmode == WellTarget::VFP){
|
||||
this->VFPTableNumber = static_cast<int> (newValue);
|
||||
}
|
||||
else if (cmode != WellTarget::GUID){
|
||||
throw std::invalid_argument("Invalid keyword (MODE) supplied");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool WellProductionProperties::operator==(const WellProductionProperties& other) const {
|
||||
return OilRate == other.OilRate
|
||||
&& WaterRate == other.WaterRate
|
||||
|
Loading…
Reference in New Issue
Block a user