opm-simulators
Loading...
Searching...
No Matches
StandardWellConnections.hpp
1/*
2 Copyright 2017 SINTEF Digital, Mathematics and Cybernetics.
3 Copyright 2017 Statoil ASA.
4 Copyright 2016 - 2017 IRIS AS.
5
6 This file is part of the Open Porous Media project (OPM).
7
8 OPM is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 OPM is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with OPM. If not, see <http://www.gnu.org/licenses/>.
20*/
21
22
23#ifndef OPM_STANDARDWELL_CONNECTIONS_HEADER_INCLUDED
24#define OPM_STANDARDWELL_CONNECTIONS_HEADER_INCLUDED
25
26#include <opm/simulators/wells/StandardWellPrimaryVariables.hpp>
27
28#include <array>
29#include <functional>
30#include <tuple>
31#include <variant>
32#include <vector>
33
34namespace Opm
35{
36
37class DeferredLogger;
38enum class Phase;
39template<typename FluidSystem, typename Indices> class WellInterfaceIndices;
40template<typename Scalar, typename IndexTraits> class WellState;
41template<class Scalar> class PerfData;
42
43template<class FluidSystem, class Indices>
45{
46public:
47 using Scalar = typename FluidSystem::Scalar;
48 using IndexTraits = typename FluidSystem::IndexTraitsType;
50
52 {
53 std::vector<Scalar> b_perf{};
54 std::vector<Scalar> rsmax_perf{};
55 std::vector<Scalar> rvmax_perf{};
56 std::vector<Scalar> rvwmax_perf{};
57 std::vector<Scalar> rswmax_perf{};
58 std::vector<Scalar> surf_dens_perf{};
59 };
60
62 {
63 std::function<Scalar(int,int)> getTemperature{};
64 std::function<Scalar(int)> getSaltConcentration{};
65 std::function<int(int)> pvtRegionIdx{};
66 std::function<Scalar(int)> solventInverseFormationVolumeFactor{};
67 std::function<Scalar(int)> solventRefDensity{};
68 };
69
71 {
72 std::function<void(int, const std::vector<int>&, std::vector<Scalar>&)> mobility{};
73 std::function<void(int, const std::vector<int>&, std::vector<Scalar>&)> densityInCell{};
74 };
75
77 computePropertiesForPressures(const WellState<Scalar, IndexTraits>& well_state,
79
82 const WellState<Scalar, IndexTraits>& well_state,
84 const Properties& props,
86
88 Scalar rho() const
89 {
90 return this->rho(0);
91 }
92
98 Scalar rho(const typename std::vector<Scalar>::size_type i) const
99 {
100 return (i < this->perf_densities_.size())
101 ? this->perf_densities_[i]
102 : 0.0;
103 }
104
106 Scalar pressure_diff(const unsigned perf) const
107 { return perf_pressure_diffs_[perf]; }
108
109 using Eval = typename WellInterfaceIndices<FluidSystem, Indices>::Eval;
111
112 Eval connectionRateBrine(Scalar& rate,
113 const Scalar vap_wat_rate,
114 const std::vector<EvalWell>& cq_s,
115 const std::variant<Scalar,EvalWell>& saltConcentration) const;
116
117 Eval connectionRateFoam(const std::vector<EvalWell>& cq_s,
118 const std::variant<Scalar,EvalWell>& foamConcentration,
119 const Phase transportPhase,
121
122 std::tuple<Eval,EvalWell>
123 connectionRatePolymer(Scalar& rate,
124 const std::vector<EvalWell>& cq_s,
125 const std::variant<Scalar,EvalWell>& polymerConcentration) const;
126
127 Eval connectionRateBioeffects(Scalar& rate,
128 const Scalar vap_wat_rate,
129 const std::vector<EvalWell>& cq_s,
130 const std::variant<Scalar,EvalWell>& microbialConcentration) const;
131
132 std::tuple<Eval,Eval,Eval>
133 connectionRatesMICP(Scalar& rate_m,
134 Scalar& rate_o,
135 Scalar& rate_u,
136 const std::vector<EvalWell>& cq_s,
137 const std::variant<Scalar,EvalWell>& microbialConcentration,
138 const std::variant<Scalar,EvalWell>& oxygenConcentration,
139 const std::variant<Scalar,EvalWell>& ureaConcentration) const;
140
141 std::tuple<Eval,EvalWell>
142 connectionRatezFraction(Scalar& rate,
143 const Scalar dis_gas_rate,
144 const std::vector<EvalWell>& cq_s,
145 const std::variant<Scalar, std::array<EvalWell,2>>& solventConcentration) const;
146
147private:
148 void computePressureDelta();
149
150 // TODO: not total sure whether it is a good idea to put this function here
151 // the major reason to put here is to avoid the usage of Wells struct
152 void computeDensities(const std::vector<Scalar>& perfComponentRates,
153 const Properties& props,
155
156 void computeDensitiesForStoppedProducer(const DensityPropertyFunctions& prop_func);
157
158 std::vector<Scalar>
159 calculatePerforationOutflow(const std::vector<Scalar>& perfComponentRates) const;
160
161 void initialiseConnectionMixture(const int num_comp,
162 const int perf,
163 const std::vector<Scalar>& q_out_perf,
164 const std::vector<Scalar>& currentMixture,
165 std::vector<Scalar>& previousMixture) const;
166
167 std::vector<Scalar>
168 copyInPerforationRates(const Properties& props,
169 const PerfData<Scalar>& perf_data) const;
170
172
173 std::vector<Scalar> perf_densities_;
174 std::vector<Scalar> perf_pressure_diffs_;
175};
176
177}
178
179#endif // OPM_STANDARDWELL_CONNECTIONS_HEADER_INCLUDED
Definition DeferredLogger.hpp:57
Definition PerfData.hpp:34
Definition StandardWellConnections.hpp:45
void computeProperties(const bool stop_or_zero_rate_target, const WellState< Scalar, IndexTraits > &well_state, const DensityPropertyFunctions &prop_func, const Properties &props, DeferredLogger &deferred_logger)
Compute connection properties (densities, pressure drop, ...)
Definition StandardWellConnections.cpp:671
Scalar pressure_diff(const unsigned perf) const
Returns pressure drop for a given perforation.
Definition StandardWellConnections.hpp:106
Scalar rho() const
Returns density for first perforation.
Definition StandardWellConnections.hpp:88
Scalar rho(const typename std::vector< Scalar >::size_type i) const
Returns density for specific perforation/connection.
Definition StandardWellConnections.hpp:98
DenseAd::DynamicEvaluation< Scalar, numStaticWellEq+Indices::numEq+1 > EvalWell
Evaluation for the well equations.
Definition StandardWellPrimaryVariables.hpp:88
Definition WellInterfaceIndices.hpp:34
The state of a set of wells, tailored for use by the fully implicit blackoil simulator.
Definition WellState.hpp:66
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:43
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:240
Definition StandardWellConnections.hpp:71
Definition StandardWellConnections.hpp:62
Definition StandardWellConnections.hpp:52