This commit is contained in:
Cíntia Gonçalves Machado 2023-11-26 11:55:32 +00:00 committed by GitHub
commit dbad8a03e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 131 additions and 9 deletions

View File

@ -102,8 +102,10 @@
"WBGLR",
"WBHP",
"WBHPH",
"WBHPT",
"WTHP",
"WTHPH",
"WTHPT",
"WPI",
"WBP",
"WBP4",

View File

@ -689,8 +689,11 @@ inline quantity glir( const fn_args& args ) {
return { alq_rate, measure::gas_surface_rate };
}
inline quantity wwirt( const fn_args& args ) {
const quantity zero = { 0, rate_unit< Opm::Phase::WATER >() };
template< rt phase, bool injection = true >
inline quantity well_rate_target( const fn_args& args ) {
quantity zero = { 0, rate_unit< Opm::Phase::WATER >() };
if (phase == rt::gas)
zero = { 0, rate_unit< Opm::Phase::GAS >() };
if (args.schedule_wells.empty()) {
return zero;
@ -698,14 +701,70 @@ inline quantity wwirt( const fn_args& args ) {
const auto* well = args.schedule_wells.front();
const auto& wtype = well->wellType();
if (wtype.producer() || (wtype.injector_type() != Opm::InjectorType::WATER)) {
return zero;
}
const auto& injection = well->injectionControls(args.st);
return { injection.surface_rate, rate_unit<Opm::Phase::WATER>() };
if (injection){
if (phase == rt::wat){
if (wtype.producer()) {
const auto& production = well->productionControls(args.st);
return { -production.water_rate, rate_unit<Opm::Phase::WATER>() };
} else if ((wtype.injector_type() != Opm::InjectorType::WATER)) {
return zero;
} else {
const auto& injectionControl = well->injectionControls(args.st);
return { injectionControl.surface_rate, rate_unit<Opm::Phase::WATER>() };
}
} else if (phase == rt::oil){
if (wtype.producer()) {
const auto& production = well->productionControls(args.st);
return { -production.oil_rate, rate_unit<Opm::Phase::OIL>() };
} else if ((wtype.injector_type() != Opm::InjectorType::OIL)){
return zero;
} else {
const auto& injectionControl = well->injectionControls(args.st);
return { injectionControl.surface_rate, rate_unit<Opm::Phase::OIL>() };
}
} else if (phase == rt::gas){
if (wtype.producer()) {
const auto& production = well->productionControls(args.st);
return { -production.gas_rate, rate_unit<Opm::Phase::GAS>() };
} else if ((wtype.injector_type() != Opm::InjectorType::GAS)) {
return zero;
} else {
const auto& injectionControl = well->injectionControls(args.st);
return { injectionControl.surface_rate, rate_unit<Opm::Phase::GAS>() };
}
} else {
return zero;
}
} else {
if (phase == rt::wat){
if (wtype.injector() ){
const auto& injectionControl = well->injectionControls(args.st);
return { -injectionControl.surface_rate, rate_unit<Opm::Phase::WATER>() };
}
const auto& production = well->productionControls(args.st);
return { production.water_rate, rate_unit<Opm::Phase::WATER>() };
} else if (phase == rt::oil){
if (wtype.injector() ){
const auto& injectionControl = well->injectionControls(args.st);
return { -injectionControl.surface_rate, rate_unit<Opm::Phase::OIL>() };
}
const auto& production = well->productionControls(args.st);
return { production.oil_rate, rate_unit<Opm::Phase::OIL>() };
} else if (phase == rt::gas){
if (wtype.injector() ){
const auto& injectionControl = well->injectionControls(args.st);
return { -injectionControl.surface_rate, rate_unit<Opm::Phase::GAS>() };
}
const auto& production = well->productionControls(args.st);
return { production.gas_rate, rate_unit<Opm::Phase::GAS>() };
} else {
return zero;
}
}
}
template< rt phase, bool injection = true >
inline quantity rate( const fn_args& args ) {
double sum = 0.0;
@ -1380,6 +1439,30 @@ inline quantity thp_history( const fn_args& args ) {
return { thp_hist, measure::pressure };
}
inline quantity bhp_target( const fn_args& args ) {
if( args.schedule_wells.empty() ) return { 0.0, measure::pressure };
const auto* sched_well = args.schedule_wells.front();
const auto bhp_target = sched_well->isProducer()
? sched_well->getProductionProperties().BHPTarget.getSI()
: sched_well->getInjectionProperties().BHPTarget.getSI();
return { bhp_target, measure::pressure };
}
inline quantity thp_target( const fn_args& args ) {
if( args.schedule_wells.empty() ) return { 0.0, measure::pressure };
const auto* sched_well = args.schedule_wells.front();
const auto thp_target = sched_well->isProducer()
? sched_well->getProductionProperties().THPTarget.getSI()
: sched_well->getInjectionProperties().THPTarget.getSI();
return { thp_target, measure::pressure };
}
inline quantity node_pressure(const fn_args& args)
{
auto nodePos = args.grp_nwrk.nodeData.find(args.group_name);
@ -1509,6 +1592,16 @@ inline quantity res_vol_production_target( const fn_args& args )
return { sum, measure::rate };
}
inline quantity res_vol_injection_target( const fn_args& args )
{
double sum = 0.0;
for (const auto* sched_well : args.schedule_wells)
if (sched_well->getInjectionProperties().predictionMode)
sum += sched_well->getInjectionProperties().reservoirInjectionRate.getSI();
return { sum, measure::rate };
}
inline quantity duration( const fn_args& args ) {
return { args.duration, measure::time };
}
@ -1942,8 +2035,7 @@ using ofun = std::function<quantity(const fn_args&)>;
using UnitTable = std::unordered_map<std::string, Opm::UnitSystem::measure>;
static const auto funs = std::unordered_map<std::string, ofun> {
{ "WWIR", rate< rt::wat, injector > },
{ "WWIRT", wwirt },
{ "WWIR", rate< rt::wat, injector > },
{ "WOIR", rate< rt::oil, injector > },
{ "WGIR", rate< rt::gas, injector > },
{ "WEIR", rate< rt::energy, injector > },
@ -1951,6 +2043,9 @@ static const auto funs = std::unordered_map<std::string, ofun> {
{ "WNIR", rate< rt::solvent, injector > },
{ "WCIR", rate< rt::polymer, injector > },
{ "WSIR", rate< rt::brine, injector > },
{ "WWIRT", well_rate_target<rt::wat, injector > },
{ "WOIRT", well_rate_target<rt::oil, injector > },
{ "WGIRT", well_rate_target<rt::gas, injector > },
// Allow phase specific interpretation of tracer related summary keywords
{ "WTIR#W", ratetracer< rt::tracer, rt::wat, injector > }, // #W: Water tracers
{ "WTIR#O", ratetracer< rt::tracer, rt::oil, injector > }, // #O: Oil tracers
@ -1979,6 +2074,9 @@ static const auto funs = std::unordered_map<std::string, ofun> {
{ "WWPR", rate< rt::wat, producer > },
{ "WOPR", rate< rt::oil, producer > },
{ "WWPRT", well_rate_target<rt::wat, producer > },
{ "WOPRT", well_rate_target<rt::oil, producer > },
{ "WGPRT", well_rate_target<rt::gas, producer > },
{ "WWPTL",mul(ratel< rt::wat, producer >, duration) },
{ "WGPTL",mul(ratel< rt::gas, producer >, duration) },
{ "WOPTL",mul(ratel< rt::oil, producer >, duration) },
@ -2071,6 +2169,7 @@ static const auto funs = std::unordered_map<std::string, ofun> {
{ "WTPCHEA", temperature< producer >},
{ "WTICHEA", temperature< injector >},
{ "WVPRT", res_vol_production_target },
{ "WVIRT", res_vol_injection_target },
{ "WMCTL", well_control_mode },
@ -2090,6 +2189,10 @@ static const auto funs = std::unordered_map<std::string, ofun> {
{ "GGIGR", group_guiderate<injector, Opm::data::GuideRateValue::Item::Gas> },
{ "GWIGR", group_guiderate<injector, Opm::data::GuideRateValue::Item::Water> },
{ "GWIRT", well_rate_target<rt::wat, injector > },
{ "GOIRT", well_rate_target<rt::oil, injector > },
{ "GGIRT", well_rate_target<rt::gas, injector > },
{ "GWIT", mul( rate< rt::wat, injector >, duration ) },
{ "GOIT", mul( rate< rt::oil, injector >, duration ) },
{ "GGIT", mul( rate< rt::gas, injector >, duration ) },
@ -2123,6 +2226,11 @@ static const auto funs = std::unordered_map<std::string, ofun> {
{ "GWPGR", group_guiderate<producer, Opm::data::GuideRateValue::Item::Water> },
{ "GVPGR", group_guiderate<producer, Opm::data::GuideRateValue::Item::ResV> },
{ "GWPRT", well_rate_target<rt::wat, producer > },
{ "GOPRT", well_rate_target<rt::oil, producer > },
{ "GGPRT", well_rate_target<rt::gas, producer > },
{ "GPR", node_pressure },
{ "NPR", converged_node_pressure },
{ "GNETPR", converged_node_pressure },
@ -2193,6 +2301,8 @@ static const auto funs = std::unordered_map<std::string, ofun> {
{ "WTHPH", thp_history },
{ "WBHPH", bhp_history },
{ "WTHPT", thp_target },
{ "WBHPT", bhp_target },
{ "GWPRH", production_history< Opm::Phase::WATER > },
{ "GOPRH", production_history< Opm::Phase::OIL > },
@ -2231,6 +2341,7 @@ static const auto funs = std::unordered_map<std::string, ofun> {
{ "GMWPR", flowing< producer > },
{ "GVPRT", res_vol_production_target },
{ "GVIRT", res_vol_injection_target },
{ "CPR", cpr },
{ "CGIRL", cratel< rt::gas, injector> },
@ -2421,6 +2532,7 @@ static const auto funs = std::unordered_map<std::string, ofun> {
{ "FMWIN", flowing< injector > },
{ "FMWPR", flowing< producer > },
{ "FVPRT", res_vol_production_target },
{ "FVIRT", res_vol_injection_target },
{ "FMWPA", abandoned_well< producer > },
{ "FMWIA", abandoned_well< injector >},
@ -2429,6 +2541,14 @@ static const auto funs = std::unordered_map<std::string, ofun> {
{ "FMCTW", group_control< false, false, true, false >},
{ "FMCTG", group_control< false, false, false, true >},
{ "FWIRT", well_rate_target<rt::wat, injector > },
{ "FOIRT", well_rate_target<rt::oil, injector > },
{ "FGIRT", well_rate_target<rt::gas, injector > },
{ "FWPRT", well_rate_target<rt::wat, producer > },
{ "FOPRT", well_rate_target<rt::oil, producer > },
{ "FGPRT", well_rate_target<rt::gas, producer > },
/* Region properties */
{ "ROIR" , region_rate< rt::oil, injector > },
{ "RGIR" , region_rate< rt::gas, injector > },