opm-simulators
MultisegmentWellGeneric.hpp
1 /*
2  Copyright 2017 SINTEF Digital, Mathematics and Cybernetics.
3  Copyright 2017 Statoil ASA.
4 
5  This file is part of the Open Porous Media project (OPM).
6 
7  OPM is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  OPM is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with OPM. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 
22 #ifndef OPM_MULTISEGMENTWELL_GENERIC_HEADER_INCLUDED
23 #define OPM_MULTISEGMENTWELL_GENERIC_HEADER_INCLUDED
24 
25 #include <vector>
26 
27 namespace Opm
28 {
29 
30 class DeferredLogger;
31 class SummaryState;
32 template<typename Scalar, typename IndexTraits> class WellInterfaceGeneric;
33 enum class WellSegmentCompPressureDrop;
34 class WellSegments;
35 template<typename Scalar, typename IndexTraits> class WellState;
36 
37 template<typename Scalar, typename IndexTraits>
38 class MultisegmentWellGeneric
39 {
40 public:
41  // get the WellSegments from the well_ecl_
42  const WellSegments& segmentSet() const;
43 
44  // segment number is an ID of the segment, it is specified in the deck
45  // get the loation of the segment with a segment number in the segmentSet
46  int segmentNumberToIndex(const int segment_number) const;
47 
49  int numberOfSegments() const;
50 
51 protected:
52  explicit MultisegmentWellGeneric(WellInterfaceGeneric<Scalar, IndexTraits>& baseif);
53 
54  // scale the segment rates and pressure based on well rates and bhp
55  void scaleSegmentRatesWithWellRates(const std::vector<std::vector<int>>& segment_inlets,
56  const std::vector<std::vector<int>>& segment_perforations,
57  WellState<Scalar, IndexTraits>& well_state) const;
58  void scaleSegmentPressuresWithBhp(WellState<Scalar, IndexTraits>& well_state) const;
59 
60  // components of the pressure drop to be included
61  WellSegmentCompPressureDrop compPressureDrop() const;
62 
64  bool update_relaxation_factor(const std::vector<Scalar>& measure_history, Scalar& relaxation_factor, bool& regularize, DeferredLogger& deferred_logger) const;
65  bool repeatedStagnation(const std::vector<Scalar>& measure_history, bool& regularize, DeferredLogger& deferred_logger) const;
66 
67  bool accelerationalPressureLossConsidered() const;
68  bool frictionalPressureLossConsidered() const;
69 
70  Scalar getSegmentDp(const int seg,
71  const Scalar density,
72  const std::vector<Scalar>& seg_dp) const;
73 
74  const WellInterfaceGeneric<Scalar, IndexTraits>& baseif_;
75 };
76 
77 }
78 
79 #endif // OPM_MULTISEGMENTWELL_GENERIC_HEADER_INCLUDED
int numberOfSegments() const
number of segments for this well
Definition: MultisegmentWellGeneric.cpp:126
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
bool update_relaxation_factor(const std::vector< Scalar > &measure_history, Scalar &relaxation_factor, bool &regularize, DeferredLogger &deferred_logger) const
Detect oscillation or stagnation based on the residual measure history.
Definition: MultisegmentWellGeneric.cpp:150