StandardWellConnections.hpp
Go to the documentation of this file.
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
27
28#include <functional>
29#include <variant>
30#include <vector>
31
32namespace Opm
33{
34
35class DeferredLogger;
36enum class Phase;
37template<class FluidSystem, class Indices> class WellInterfaceIndices;
38template<class Scalar> class WellState;
39
40template<class FluidSystem, class Indices>
42{
43public:
44 using Scalar = typename FluidSystem::Scalar;
46
48 {
49 std::vector<Scalar> b_perf;
50 std::vector<Scalar> rsmax_perf;
51 std::vector<Scalar> rvmax_perf;
52 std::vector<Scalar> rvwmax_perf;
53 std::vector<Scalar> rswmax_perf;
54 std::vector<Scalar> surf_dens_perf;
55 };
56
58 const std::function<Scalar(int,int)>& getTemperature,
59 const std::function<Scalar(int)>& getSaltConcentration,
60 const std::function<int(int)>& pvtRegionIdx,
61 const std::function<Scalar(int)>& solventInverseFormationVolumeFactor,
62 const std::function<Scalar(int)>& solventRefDensity,
63 Properties& props) const;
64
66 void computeProperties(const WellState<Scalar>& well_state,
67 const std::function<Scalar(int,int)>& invB,
68 const std::function<Scalar(int,int)>& mobility,
69 const std::function<Scalar(int)>& solventInverseFormationVolumeFactor,
70 const std::function<Scalar(int)>& solventMobility,
71 const Properties& props,
72 DeferredLogger& deferred_logger);
73
75 Scalar rho() const
76 {
77 return this->rho(0);
78 }
79
85 Scalar rho(const typename std::vector<Scalar>::size_type i) const
86 {
87 return (i < this->perf_densities_.size())
88 ? this->perf_densities_[i]
89 : 0.0;
90 }
91
93 Scalar pressure_diff(const unsigned perf) const
94 { return perf_pressure_diffs_[perf]; }
95
98
100 const double vap_wat_rate,
101 const std::vector<EvalWell>& cq_s,
102 const std::variant<Scalar,EvalWell>& saltConcentration) const;
103
104 Eval connectionRateFoam(const std::vector<EvalWell>& cq_s,
105 const std::variant<Scalar,EvalWell>& foamConcentration,
106 const Phase transportPhase,
107 DeferredLogger& deferred_logger) const;
108
109 std::tuple<Eval,EvalWell>
111 const std::vector<EvalWell>& cq_s,
112 const std::variant<Scalar,EvalWell>& polymerConcentration) const;
113
114 std::tuple<Eval,Eval,Eval>
115 connectionRatesMICP(const std::vector<EvalWell>& cq_s,
116 const std::variant<Scalar,EvalWell>& microbialConcentration,
117 const std::variant<Scalar,EvalWell>& oxygenConcentration,
118 const std::variant<Scalar,EvalWell>& ureaConcentration) const;
119
120 std::tuple<Eval,EvalWell>
122 const double dis_gas_rate,
123 const std::vector<EvalWell>& cq_s,
124 const std::variant<Scalar, std::array<EvalWell,2>>& solventConcentration) const;
125
126private:
127 void computePressureDelta();
128
129 // TODO: not total sure whether it is a good idea to put this function here
130 // the major reason to put here is to avoid the usage of Wells struct
131 void computeDensities(const std::vector<Scalar>& perfComponentRates,
132 const Properties& props,
133 DeferredLogger& deferred_logger);
134
136
137 std::vector<Scalar> perf_densities_;
138 std::vector<Scalar> perf_pressure_diffs_;
139};
140
141}
142
143#endif // OPM_STANDARDWELL_CONNECTIONS_HEADER_INCLUDED
Definition: DeferredLogger.hpp:57
Definition: StandardWellConnections.hpp:42
StandardWellConnections(const WellInterfaceIndices< FluidSystem, Indices > &well)
Eval connectionRateFoam(const std::vector< EvalWell > &cq_s, const std::variant< Scalar, EvalWell > &foamConcentration, const Phase transportPhase, DeferredLogger &deferred_logger) const
typename WellInterfaceIndices< FluidSystem, Indices >::Eval Eval
Definition: StandardWellConnections.hpp:96
std::tuple< Eval, EvalWell > connectionRatezFraction(double &rate, const double dis_gas_rate, const std::vector< EvalWell > &cq_s, const std::variant< Scalar, std::array< EvalWell, 2 > > &solventConcentration) const
void computePropertiesForPressures(const WellState< Scalar > &well_state, const std::function< Scalar(int, int)> &getTemperature, const std::function< Scalar(int)> &getSaltConcentration, const std::function< int(int)> &pvtRegionIdx, const std::function< Scalar(int)> &solventInverseFormationVolumeFactor, const std::function< Scalar(int)> &solventRefDensity, Properties &props) const
Scalar pressure_diff(const unsigned perf) const
Returns pressure drop for a given perforation.
Definition: StandardWellConnections.hpp:93
Eval connectionRateBrine(double &rate, const double vap_wat_rate, const std::vector< EvalWell > &cq_s, const std::variant< Scalar, EvalWell > &saltConcentration) const
void computeProperties(const WellState< Scalar > &well_state, const std::function< Scalar(int, int)> &invB, const std::function< Scalar(int, int)> &mobility, const std::function< Scalar(int)> &solventInverseFormationVolumeFactor, const std::function< Scalar(int)> &solventMobility, const Properties &props, DeferredLogger &deferred_logger)
Compute connection properties (densities, pressure drop, ...)
std::tuple< Eval, Eval, Eval > connectionRatesMICP(const std::vector< EvalWell > &cq_s, const std::variant< Scalar, EvalWell > &microbialConcentration, const std::variant< Scalar, EvalWell > &oxygenConcentration, const std::variant< Scalar, EvalWell > &ureaConcentration) const
Scalar rho() const
Returns density for first perforation.
Definition: StandardWellConnections.hpp:75
Scalar rho(const typename std::vector< Scalar >::size_type i) const
Returns density for specific perforation/connection.
Definition: StandardWellConnections.hpp:85
std::tuple< Eval, EvalWell > connectionRatePolymer(double &rate, const std::vector< EvalWell > &cq_s, const std::variant< Scalar, EvalWell > &polymerConcentration) const
typename FluidSystem::Scalar Scalar
Definition: StandardWellConnections.hpp:44
typename StandardWellPrimaryVariables< FluidSystem, Indices >::EvalWell EvalWell
Definition: StandardWellConnections.hpp:97
DenseAd::DynamicEvaluation< Scalar, numStaticWellEq+Indices::numEq+1 > EvalWell
Evaluation for the well equations.
Definition: StandardWellPrimaryVariables.hpp:87
Definition: WellInterfaceIndices.hpp:35
DenseAd::Evaluation< Scalar, Indices::numEq > Eval
Definition: WellInterfaceIndices.hpp:41
Definition: WellState.hpp:62
Definition: BlackoilPhases.hpp:27
Definition: StandardWellConnections.hpp:48
std::vector< Scalar > surf_dens_perf
Definition: StandardWellConnections.hpp:54
std::vector< Scalar > rvwmax_perf
Definition: StandardWellConnections.hpp:52
std::vector< Scalar > rsmax_perf
Definition: StandardWellConnections.hpp:50
std::vector< Scalar > b_perf
Definition: StandardWellConnections.hpp:49
std::vector< Scalar > rswmax_perf
Definition: StandardWellConnections.hpp:53
std::vector< Scalar > rvmax_perf
Definition: StandardWellConnections.hpp:51