My Project
MultisegmentWellSegments.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_SEGMENTS_HEADER_INCLUDED
23#define OPM_MULTISEGMENTWELL_SEGMENTS_HEADER_INCLUDED
24
25#include <opm/simulators/wells/MultisegmentWellPrimaryVariables.hpp>
26
27#include <vector>
28
29namespace Opm
30{
31
32class UnitSystem;
33class WellInterfaceGeneric;
34
35template<typename FluidSystem, typename Indices, typename Scalar>
37{
39 using EvalWell = typename PrimaryVariables::EvalWell;
40
41public:
42 MultisegmentWellSegments(const int numSegments,
44
45 void computeFluidProperties(const EvalWell& temperature,
46 const EvalWell& saltConcentration,
47 const PrimaryVariables& primary_variables,
48 int pvt_region_index,
49 DeferredLogger& deferred_logger);
50
52 void updateUpwindingSegments(const PrimaryVariables& primary_variables);
53
54 EvalWell getHydroPressureLoss(const int seg) const;
55
57 Scalar getPressureDiffSegPerf(const int seg,
58 const int perf) const;
59
60 EvalWell getSurfaceVolume(const EvalWell& temperature,
61 const EvalWell& saltConcentration,
62 const PrimaryVariables& primary_variables,
63 const int pvt_region_index,
64 const int seg_idx) const;
65
66 EvalWell getFrictionPressureLoss(const int seg) const;
67
68 // pressure drop for Spiral ICD segment (WSEGSICD)
69 EvalWell pressureDropSpiralICD(const int seg) const;
70
71 // pressure drop for Autonomous ICD segment (WSEGAICD)
72 EvalWell pressureDropAutoICD(const int seg,
73 const UnitSystem& unit_system) const;
74
75 // pressure drop for sub-critical valve (WSEGVALV)
76 EvalWell pressureDropValve(const int seg) const;
77
78 // pressure loss due to acceleration
79 EvalWell accelerationPressureLoss(const int seg) const;
80
81 const std::vector<std::vector<int>>& inlets() const
82 {
83 return inlets_;
84 }
85
86 const std::vector<std::vector<int>>& perforations() const
87 {
88 return perforations_;
89 }
90
91 int upwinding_segment(const int seg) const
92 {
93 return upwinding_segments_[seg];
94 }
95
96 Scalar getRefDensity() const
97 {
98 return densities_[0].value();
99 }
100
101 const EvalWell& density(const int seg) const
102 {
103 return densities_[seg];
104 }
105
106 Scalar perforation_depth_diff(const int perf) const
107 {
108 return perforation_depth_diffs_[perf];
109 }
110
111private:
112 // TODO: trying to use the information from the Well opm-parser as much
113 // as possible, it will possibly be re-implemented later for efficiency reason.
114
115 // the completions that is related to each segment
116 // the completions's ids are their index in the vector well_index_, well_cell_
117 // This is also assuming the order of the completions in Well is the same with
118 // the order of the completions in wells.
119 // it is for convinience reason. we can just calcuate the inforation for segment once then using it for all the perofrations
120 // belonging to this segment
121 std::vector<std::vector<int>> perforations_;
122
123 // depth difference between the segment and the perforation
124 // or in another way, the depth difference between the perforation and
125 // the segment the perforation belongs to
126 std::vector<Scalar> perforation_depth_diffs_;
127
128 // the inlet segments for each segment. It is for convenience and efficiency reason
129 std::vector<std::vector<int>> inlets_;
130
131 std::vector<Scalar> depth_diffs_;
132
133 // the densities of segment fluids
134 // we should not have this member variable
135 std::vector<EvalWell> densities_;
136
137 // the mass rate of the segments
138 std::vector<EvalWell> mass_rates_;
139
140 // the viscosity of the segments
141 std::vector<EvalWell> viscosities_;
142
143 // the upwinding segment for each segment based on the flow direction
144 std::vector<int> upwinding_segments_;
145
146 std::vector<std::vector<EvalWell>> phase_densities_;
147 std::vector<std::vector<EvalWell>> phase_fractions_;
148 std::vector<std::vector<EvalWell>> phase_viscosities_;
149
150 const WellInterfaceGeneric& well_;
151};
152
153}
154
155#endif // OPM_MULTISEGMENTWELL_SEGMENTS_HEADER_INCLUDED
Definition: DeferredLogger.hpp:57
Definition: MultisegmentWellPrimaryVariables.hpp:42
Definition: MultisegmentWellSegments.hpp:37
Scalar getPressureDiffSegPerf(const int seg, const int perf) const
Pressure difference between segment and perforation.
Definition: MultisegmentWellSegments.cpp:331
void updateUpwindingSegments(const PrimaryVariables &primary_variables)
Update upwinding segments.
Definition: MultisegmentWellSegments.cpp:297
Definition: WellInterfaceGeneric.hpp:51
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:27