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