opm-simulators
blackoiltwophaseindices.hh
Go to the documentation of this file.
1 // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 // vi: set et ts=4 sw=4 sts=4:
3 /*
4  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 2 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 
19  Consult the COPYING file in the top-level source directory of this
20  module for the precise wording of the license and the list of
21  copyright holders.
22 */
28 #ifndef EWOMS_BLACK_OIL_TWO_PHASE_INDICES_HH
29 #define EWOMS_BLACK_OIL_TWO_PHASE_INDICES_HH
30 
31 #include <opm/common/utility/ConstexprAssert.hpp>
32 
33 #include <cassert>
34 #include <limits>
35 
36 namespace Opm {
37 
43 template<unsigned numSolventsV,
44  unsigned numExtbosV,
45  unsigned numPolymersV,
46  unsigned numEnergyV,
47  bool enableFoam,
48  bool enableBrine,
49  int PVOffset,
50  unsigned disabledCanonicalCompIdx,
51  unsigned numBioCompV>
53 {
55  static constexpr bool oilEnabled = disabledCanonicalCompIdx != 0;
56  static constexpr bool waterEnabled = disabledCanonicalCompIdx != 1;
57  static constexpr bool gasEnabled = disabledCanonicalCompIdx != 2;
58 
60  static constexpr bool enableSolvent = numSolventsV > 0;
61 
63  static constexpr bool enableExtbo = numExtbosV > 0;
64 
66  static constexpr bool enablePolymer = numPolymersV > 0;
67 
69  static constexpr bool enableFullyImplicitThermal = numEnergyV > 0;
70 
72  static constexpr bool enableMICP = false;
73 
75  static constexpr bool enableBiofilm = numBioCompV > 0;
76 
78  static constexpr int numSolvents = enableSolvent ? numSolventsV : 0;
79 
81  static constexpr int numExtbos = enableExtbo ? numExtbosV : 0;
82 
84  static constexpr int numPolymers = enablePolymer ? numPolymersV : 0;
85 
87  static constexpr int numEnergy = enableFullyImplicitThermal ? numEnergyV : 0;
88 
90  static constexpr int numFoam = enableFoam? 1 : 0;
91 
93  static constexpr int numBrine = enableBrine? 1 : 0;
94 
96  static constexpr int numBioComp = enableBiofilm ? numBioCompV : 0;
97 
99  static constexpr int numBioInWat = enableBiofilm ? 1 : 0;
100 
102  static constexpr int numPhases = 2;
103 
105  static constexpr int numEq = numPhases + numSolvents + numExtbos + numPolymers +
107 
109  static constexpr int numDerivatives = numEq;
110 
112  // Primary variable indices
114 
123  static constexpr unsigned waterSwitchIdx =
124  waterEnabled ? PVOffset + 0
125  : std::numeric_limits<unsigned>::max();
126 
133  static constexpr unsigned pressureSwitchIdx =
134  waterEnabled ? PVOffset + 1
135  : PVOffset + 0;
136 
143  static constexpr unsigned compositionSwitchIdx =
144  gasEnabled && oilEnabled ? PVOffset + 1
145  : std::numeric_limits<unsigned>::max();
146 
148  static constexpr unsigned solventSaturationIdx =
149  enableSolvent ? PVOffset + numPhases
150  : std::numeric_limits<unsigned>::max();
151 
153  static constexpr unsigned zFractionIdx =
154  enableExtbo ? PVOffset + numPhases + numSolvents
155  : std::numeric_limits<unsigned>::max();
156 
158  static constexpr unsigned polymerConcentrationIdx =
159  enablePolymer ? PVOffset + numPhases + numSolvents
160  : std::numeric_limits<unsigned>::max();
161 
163  static constexpr unsigned polymerMoleWeightIdx =
165  : std::numeric_limits<unsigned>::max();
166 
168  static constexpr unsigned microbialConcentrationIdx =
169  enableBiofilm ? PVOffset + numPhases + numSolvents
170  : std::numeric_limits<unsigned>::max();
171 
173  static constexpr unsigned biofilmVolumeFractionIdx =
174  enableBiofilm ? PVOffset + numPhases + numSolvents + 1
175  : std::numeric_limits<unsigned>::max();
176 
178  static constexpr unsigned oxygenConcentrationIdx = std::numeric_limits<unsigned>::max();
179  static constexpr unsigned ureaConcentrationIdx = std::numeric_limits<unsigned>::max();
180  static constexpr unsigned calciteVolumeFractionIdx = std::numeric_limits<unsigned>::max();
181 
183  static constexpr unsigned foamConcentrationIdx =
184  enableFoam ? PVOffset + numPhases + numSolvents + numPolymers + numBioComp
185  : std::numeric_limits<unsigned>::max();
186 
188  static constexpr unsigned saltConcentrationIdx =
189  enableBrine ? PVOffset + numPhases + numSolvents + numPolymers + numBioComp + numFoam
190  : std::numeric_limits<unsigned>::max();
191 
193  static constexpr unsigned temperatureIdx =
196  : std::numeric_limits<unsigned>::max();
197 
199  // Equation indices
201 
203  static constexpr int conti0EqIdx = PVOffset + 0;
204  // one continuity equation follows
205 
207  static constexpr int contiSolventEqIdx =
208  enableSolvent ? PVOffset + numPhases : -1000;
209 
211  static constexpr int contiZfracEqIdx =
212  enableExtbo ? PVOffset + numPhases + numSolvents : -1000;
213 
215  static constexpr int contiPolymerEqIdx =
216  enablePolymer ? PVOffset + numPhases + numSolvents : -1000;
217 
219  static constexpr int contiPolymerMWEqIdx =
220  numPolymers > 1 ? contiPolymerEqIdx + 1 : -1000;
221 
223  static constexpr int contiMicrobialEqIdx =
224  enableBiofilm ? PVOffset + numPhases + numSolvents : -1000;
225 
227  static constexpr int contiBiofilmEqIdx =
228  enableBiofilm ? PVOffset + numPhases + numSolvents + 1 : -1000;
229 
231  static constexpr int contiOxygenEqIdx = -1000;
232  static constexpr int contiUreaEqIdx = -1000;
233  static constexpr int contiCalciteEqIdx = -1000;
234 
236  static constexpr int contiFoamEqIdx =
237  enableFoam ? PVOffset + numPhases + numSolvents + numPolymers + numBioComp : -1000;
238 
240  static constexpr int contiBrineEqIdx =
241  enableBrine ? PVOffset + numPhases + numSolvents + numPolymers + numBioComp + numFoam : -1000;
242 
244  static constexpr int contiEnergyEqIdx =
246 };
247 
248 } // namespace Opm
249 
250 #endif
static constexpr unsigned solventSaturationIdx
Index of the primary variable for the first solvent.
Definition: blackoiltwophaseindices.hh:148
static constexpr int contiEnergyEqIdx
Index of the continuity equation for energy.
Definition: blackoiltwophaseindices.hh:244
static constexpr bool enableBiofilm
Are biofilms involved?
Definition: blackoiltwophaseindices.hh:75
static constexpr int numEnergy
Number of energy equations to be considered.
Definition: blackoiltwophaseindices.hh:87
static constexpr int numBrine
Number of salt equations to be considered.
Definition: blackoiltwophaseindices.hh:93
static constexpr bool enableSolvent
Are solvents involved?
Definition: blackoiltwophaseindices.hh:60
static constexpr unsigned waterSwitchIdx
Index of the switching variable which determines the composistion of the water phase.
Definition: blackoiltwophaseindices.hh:123
static constexpr int contiPolymerEqIdx
Index of the continuity equation for the first polymer component.
Definition: blackoiltwophaseindices.hh:215
static constexpr int contiPolymerMWEqIdx
Index of the continuity equation for the second polymer component (molecular weight) ...
Definition: blackoiltwophaseindices.hh:219
static constexpr unsigned saltConcentrationIdx
Index of the primary variable for the salt.
Definition: blackoiltwophaseindices.hh:188
Structs needed for tpfalinearizer and its gpuparams struct extracted to be defined in one place that ...
Definition: blackoilbioeffectsmodules.hh:45
static constexpr bool enableMICP
MICP only available for one phase indices.
Definition: blackoiltwophaseindices.hh:72
The primary variable and equation indices for the black-oil model.
Definition: blackoiltwophaseindices.hh:52
static constexpr int conti0EqIdx
Index of the continuity equation of the first phase.
Definition: blackoiltwophaseindices.hh:203
static constexpr unsigned compositionSwitchIdx
Index of the switching variable which determines the composition of the hydrocarbon phases...
Definition: blackoiltwophaseindices.hh:143
static constexpr unsigned temperatureIdx
Index of the primary variable for temperature.
Definition: blackoiltwophaseindices.hh:193
static constexpr bool enableFullyImplicitThermal
Shall energy be conserved?
Definition: blackoiltwophaseindices.hh:69
static constexpr int contiBrineEqIdx
Index of the continuity equation for the salt component.
Definition: blackoiltwophaseindices.hh:240
static constexpr int numDerivatives
We may want to evaluate with more derivatives that equations, but not this time.
Definition: blackoiltwophaseindices.hh:109
static constexpr int numPhases
The number of fluid phases.
Definition: blackoiltwophaseindices.hh:102
static constexpr int numSolvents
Number of solvent components to be considered.
Definition: blackoiltwophaseindices.hh:78
static constexpr bool enablePolymer
Are polymers involved?
Definition: blackoiltwophaseindices.hh:66
static constexpr unsigned polymerConcentrationIdx
Index of the primary variable for the first polymer.
Definition: blackoiltwophaseindices.hh:158
static constexpr int numEq
The number of equations.
Definition: blackoiltwophaseindices.hh:105
static constexpr unsigned pressureSwitchIdx
Index of the switching variable which determines the pressure.
Definition: blackoiltwophaseindices.hh:133
static constexpr int contiBiofilmEqIdx
Index of the continuity equation for the biofilm component.
Definition: blackoiltwophaseindices.hh:227
static constexpr bool enableExtbo
Is extbo invoked?
Definition: blackoiltwophaseindices.hh:63
static constexpr int contiZfracEqIdx
Index of the continuity equation for the first extbo component.
Definition: blackoiltwophaseindices.hh:211
static constexpr int numBioInWat
Number of biocomponents in the water phase.
Definition: blackoiltwophaseindices.hh:99
static constexpr int numBioComp
Number of biofilm equations to be considered.
Definition: blackoiltwophaseindices.hh:96
static constexpr int contiSolventEqIdx
Index of the continuity equation for the first solvent component.
Definition: blackoiltwophaseindices.hh:207
static constexpr int contiOxygenEqIdx
MICP only available for one phase indices.
Definition: blackoiltwophaseindices.hh:231
static constexpr int numExtbos
Number of components to be considered for extbo.
Definition: blackoiltwophaseindices.hh:81
static constexpr unsigned oxygenConcentrationIdx
MICP only available for one phase indices.
Definition: blackoiltwophaseindices.hh:178
static constexpr unsigned zFractionIdx
Index of the primary variable for the first extbo component.
Definition: blackoiltwophaseindices.hh:153
static constexpr int numPolymers
Number of polymer components to be considered.
Definition: blackoiltwophaseindices.hh:84
static constexpr bool oilEnabled
Is phase enabled or not.
Definition: blackoiltwophaseindices.hh:55
static constexpr unsigned polymerMoleWeightIdx
Index of the primary variable for the second polymer primary variable (molecular weight) ...
Definition: blackoiltwophaseindices.hh:163
static constexpr unsigned biofilmVolumeFractionIdx
Index of the primary variable for the biofilm component.
Definition: blackoiltwophaseindices.hh:173
static constexpr int contiFoamEqIdx
Index of the continuity equation for the foam component.
Definition: blackoiltwophaseindices.hh:236
static constexpr int contiMicrobialEqIdx
Index of the continuity equation for the first microbial component.
Definition: blackoiltwophaseindices.hh:223
static constexpr unsigned foamConcentrationIdx
Index of the primary variable for the foam.
Definition: blackoiltwophaseindices.hh:183
static constexpr unsigned microbialConcentrationIdx
Index of the primary variable for the first microbial component.
Definition: blackoiltwophaseindices.hh:168
static constexpr int numFoam
Number of foam equations to be considered.
Definition: blackoiltwophaseindices.hh:90