My Project
Loading...
Searching...
No Matches
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#include <opm/simulators/wells/ParallelWellInfo.hpp>
27
28#include <cstddef>
29#include <vector>
30
31namespace Opm {
32
33 class AutoICD;
34 struct PhaseUsage;
35 template<class Scalar> class SegmentState;
36 class UnitSystem;
37 template<class Scalar> class WellInterfaceGeneric;
38 class SummaryState;
39
40} // namespace Opm
41
42namespace Opm {
43
44template<typename FluidSystem, typename Indices>
46{
48 using Scalar = typename FluidSystem::Scalar;
49 using EvalWell = typename PrimaryVariables::EvalWell;
50
51public:
55
56 void computeFluidProperties(const EvalWell& temperature,
57 const EvalWell& saltConcentration,
61
64
65 EvalWell getHydroPressureLoss(const int seg,
66 const int seg_side) const;
67
69 Scalar getPressureDiffSegLocalPerf(const int seg,
70 const int local_perf_index) const;
71
72 EvalWell getSurfaceVolume(const EvalWell& temperature,
73 const EvalWell& saltConcentration,
75 const int pvt_region_index,
76 const int seg_idx) const;
77
78 EvalWell getFrictionPressureLoss(const int seg,
79 const bool extra_reverse_flow_derivatives = false) const;
80
81 // pressure drop for Spiral ICD segment (WSEGSICD)
82 EvalWell pressureDropSpiralICD(const int seg,
83 const bool extra_reverse_flow_derivatives = false) const;
84
85 // pressure drop for Autonomous ICD segment (WSEGAICD)
86 EvalWell pressureDropAutoICD(const int seg,
88 const bool extra_reverse_flow_derivatives = false) const;
89
90 // pressure drop for sub-critical valve (WSEGVALV)
91 EvalWell pressureDropValve(const int seg,
92 const SummaryState& st,
93 const bool extra_reverse_flow_derivatives = false) const;
94
95 // pressure loss contribution due to acceleration
96 EvalWell accelerationPressureLossContribution(const int seg,
97 const Scalar area,
98 const bool extra_reverse_flow_derivatives = false) const;
99
100 const std::vector<std::vector<int>>& inlets() const
101 {
102 return inlets_;
103 }
104
105 const std::vector<int>& inlets(const int seg) const
106 {
107 return inlets_[seg];
108 }
109
110 const std::vector<std::vector<int>>& perforations() const
111 {
112 return perforations_;
113 }
114
115 int upwinding_segment(const int seg) const
116 {
117 return upwinding_segments_[seg];
118 }
119
120 Scalar getRefDensity() const
121 {
122 return densities_[0].value();
123 }
124
125 const EvalWell& density(const int seg) const
126 {
127 return densities_[seg];
128 }
129
130 Scalar local_perforation_depth_diff(const int local_perf_index) const
131 {
132 return local_perforation_depth_diffs_[local_perf_index];
133 }
134
135 void copyPhaseDensities(const PhaseUsage& pu,
137
138private:
139 // TODO: trying to use the information from the Well opm-parser as much
140 // as possible, it will possibly be re-implemented later for efficiency reason.
141
142 // the completions that is related to each segment
143 // the completions's ids are their index in the vector well_index_, well_cell_
144 // This is also assuming the order of the completions in Well is the same with
145 // the order of the completions in wells.
146 // it is for convenience reason. we can just calculate the information for segment once
147 // then using it for all the perforations belonging to this segment
148 std::vector<std::vector<int>> perforations_;
149
150 // depth difference between the segment and the perforation
151 // or in another way, the depth difference between the perforation and
152 // the segment the perforation belongs to
153 // This vector contains the depth differences for *all* perforations across all processes
154 // that this well lies on, its size is well.wellEcl().getConnections().size(),
155 // also it works with *global* perforation indices!
156 std::vector<Scalar> local_perforation_depth_diffs_;
157
158 // the inlet segments for each segment. It is for convenience and efficiency reason
159 std::vector<std::vector<int>> inlets_;
160
161 std::vector<Scalar> depth_diffs_;
162
163 // the densities of segment fluids
164 // we should not have this member variable
165 std::vector<EvalWell> densities_;
166
167 // the mass rate of the segments
168 std::vector<EvalWell> mass_rates_;
169
170 // the viscosity of the segments
171 std::vector<EvalWell> viscosities_;
172
173 // the upwinding segment for each segment based on the flow direction
174 std::vector<int> upwinding_segments_;
175
176 std::vector<std::vector<EvalWell>> phase_densities_;
177 std::vector<std::vector<EvalWell>> phase_fractions_;
178 std::vector<std::vector<EvalWell>> phase_viscosities_;
179
181
182 void copyPhaseDensities(const unsigned phaseIdx,
183 const std::size_t stride,
184 Scalar* dens) const;
185
186 Scalar mixtureDensity(const int seg) const;
187 Scalar mixtureDensityWithExponents(const int seg) const;
188 Scalar mixtureDensityWithExponents(const AutoICD& aicd, const int seg) const;
189};
190
191} // namespace Opm
192
193#endif // OPM_MULTISEGMENTWELL_SEGMENTS_HEADER_INCLUDED
Definition DeferredLogger.hpp:57
Definition MultisegmentWellPrimaryVariables.hpp:45
Definition MultisegmentWellSegments.hpp:46
void updateUpwindingSegments(const PrimaryVariables &primary_variables)
Update upwinding segments.
Definition MultisegmentWellSegments.cpp:315
Scalar getPressureDiffSegLocalPerf(const int seg, const int local_perf_index) const
Pressure difference between segment and perforation.
Definition MultisegmentWellSegments.cpp:350
Class encapsulating some information about parallel wells.
Definition ParallelWellInfo.hpp:195
Definition SegmentState.hpp:34
Definition WellInterfaceGeneric.hpp:53
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilboundaryratevector.hh:37
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:242
Definition BlackoilPhases.hpp:46