diff --git a/opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateModel.hpp b/opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateModel.hpp index 78553baa1..4c73cb2b7 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateModel.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateModel.hpp @@ -66,6 +66,7 @@ public: static Target convert_target(Group2::GuideRateTarget group_target); static Target convert_target(Well2::GuideRateTarget well_target); private: + double pot(double oil_pot, double gas_pot, double wat_pot) const; /* Unfortunately the default values will give a GuideRateModel which can not be evaluated, due to a division by zero problem. diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateModel.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateModel.cpp index fc56a7c54..282184eab 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateModel.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateModel.cpp @@ -68,32 +68,52 @@ GuideRateModel::GuideRateModel(double time_interval_arg, throw std::logic_error("Sorry - the 'COMB' mode is not supported"); } +double GuideRateModel::pot(double oil_pot, double gas_pot, double wat_pot) const { + switch (this->m_target) { + case Target::OIL: + return oil_pot; + case Target::LIQ: + return oil_pot + wat_pot; + + case Target::GAS: + return gas_pot; + + case Target::COMB: + throw std::logic_error("Not implemented - don't have a clue?"); + + case Target::RES: + throw std::logic_error("Not implemented - don't have a clue?"); + + default: + throw std::logic_error("Hmmm - should not be here?"); + } +} double GuideRateModel::eval(double oil_pot, double gas_pot, double wat_pot) const { if (this->default_model) throw std::invalid_argument("The default GuideRateModel can not be evaluated - must enter GUIDERAT information explicitly."); - double pot; + double pot = this->pot(oil_pot, gas_pot, wat_pot); + if (pot == 0) + return 0; + + double R1; double R2; - switch (this->m_target) { case Target::OIL: - pot = oil_pot; R1 = wat_pot / oil_pot; R2 = gas_pot / oil_pot; break; case Target::LIQ: - pot = oil_pot + wat_pot;; R1 = oil_pot / (oil_pot + wat_pot); R2 = wat_pot / (oil_pot + wat_pot); break; case Target::GAS: - pot = gas_pot; R1 = wat_pot / gas_pot; R2 = oil_pot / gas_pot; break;