From dbe047a8a5bcab844813d26b4c9ccc9a8842670d Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Thu, 15 Nov 2018 14:30:32 +0100 Subject: [PATCH] adding function operabilityCheckingUnderTHP to VFPProdProperties To test the operability under THP limit. --- opm/autodiff/VFPProdProperties.cpp | 31 ++++++++++++++++++++++++++++++ opm/autodiff/VFPProdProperties.hpp | 10 ++++++++++ 2 files changed, 41 insertions(+) diff --git a/opm/autodiff/VFPProdProperties.cpp b/opm/autodiff/VFPProdProperties.cpp index f86c0be40..cc2ded314 100644 --- a/opm/autodiff/VFPProdProperties.cpp +++ b/opm/autodiff/VFPProdProperties.cpp @@ -253,4 +253,35 @@ calculateBhpWithTHPTarget(const std::vector& ipr_a, + +void VFPProdProperties:: +operabilityCheckingUnderTHP(const std::vector& ipr_a, + const std::vector& ipr_b, + const double bhp_limit, + const double thp_table_id, + const double thp_limit, + const double alq, + const double dp, + bool& obtain_solution_with_thp_limit, + bool& violate_bhp_limit_with_thp_limit) const +{ + const double obtain_bhp = calculateBhpWithTHPTarget(ipr_a, ipr_b, bhp_limit, thp_table_id, thp_limit, alq, dp); + + if (obtain_bhp > 0.) { + obtain_solution_with_thp_limit = true; + + violate_bhp_limit_with_thp_limit = (obtain_bhp < bhp_limit); + + if (obtain_bhp < thp_limit) { + std::cout << " obtain_bhp " << obtain_bhp / 1.e5 << " is SMALLER than thp limit " << thp_limit / 1.e5 << std::endl; + } + + } else { + obtain_solution_with_thp_limit = false; + std::cout << " COULD NOT find an Intersection point, the well might need to be closed " << std::endl; + violate_bhp_limit_with_thp_limit = false; + } +} + + } diff --git a/opm/autodiff/VFPProdProperties.hpp b/opm/autodiff/VFPProdProperties.hpp index cbf94fda4..e0b55dd69 100644 --- a/opm/autodiff/VFPProdProperties.hpp +++ b/opm/autodiff/VFPProdProperties.hpp @@ -184,6 +184,16 @@ public: const double alq, const double dp) const; + void operabilityCheckingUnderTHP(const std::vector& ipr_a, + const std::vector& ipr_b, + const double bhp_limit, + const double thp_table_id, + const double thp_limit, + const double alq, + const double dp, + bool& obtain_solution_with_thp_limit, + bool& voilate_bhp_limit_with_thp_limit) const; + protected: // calculate a group bhp values with a group of flo rate values std::vector bhpwithflo(const std::vector& flos,