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