opm-simulators
blackoilonephaseindices.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_ONE_PHASE_INDICES_HH
29 #define EWOMS_BLACK_OIL_ONE_PHASE_INDICES_HH
30 
31 #include <cassert>
32 #include <limits>
33 
34 #include <opm/common/utility/ConstexprAssert.hpp>
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  unsigned PVOffset,
50  unsigned canonicalCompIdx,
51  unsigned numBioCompV>
53 {
55  static constexpr bool oilEnabled = canonicalCompIdx == 0;
56  static constexpr bool waterEnabled = canonicalCompIdx == 1;
57  static constexpr bool gasEnabled = canonicalCompIdx == 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 = numBioCompV == 5;
73 
75  static constexpr bool enableBiofilm = false;
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 numPhases = 1;
97 
99  static constexpr int numMICPs = enableMICP ? numBioCompV : 0;
100 
102  static constexpr int numBioInWat = enableMICP ? 3 : 0;
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 = std::numeric_limits<unsigned>::max();
124 
131  static constexpr unsigned pressureSwitchIdx = PVOffset + 0;
132 
139  static constexpr unsigned compositionSwitchIdx = std::numeric_limits<unsigned>::max();
140 
142  static constexpr unsigned solventSaturationIdx =
143  enableSolvent ? PVOffset + numPhases
144  : std::numeric_limits<unsigned>::max();
145 
147  static constexpr unsigned zFractionIdx =
148  enableExtbo ? PVOffset + numPhases + numSolvents
149  : std::numeric_limits<unsigned>::max();
150 
152  static constexpr unsigned polymerConcentrationIdx =
153  enablePolymer ? PVOffset + numPhases + numSolvents
154  : std::numeric_limits<unsigned>::max();
155 
157  static constexpr unsigned polymerMoleWeightIdx =
159  : std::numeric_limits<unsigned>::max();
160 
162  static constexpr unsigned microbialConcentrationIdx =
163  enableMICP ? PVOffset + numPhases + numSolvents
164  : std::numeric_limits<unsigned>::max();
165 
167  static constexpr unsigned oxygenConcentrationIdx =
169  : std::numeric_limits<unsigned>::max();
170 
172  static constexpr unsigned ureaConcentrationIdx =
174  : std::numeric_limits<unsigned>::max();
175 
177  static constexpr unsigned biofilmVolumeFractionIdx =
179  : std::numeric_limits<unsigned>::max();
180 
182  static constexpr unsigned calciteVolumeFractionIdx =
184  : std::numeric_limits<unsigned>::max();
185 
187  static constexpr unsigned foamConcentrationIdx =
188  enableFoam ? PVOffset + numPhases + numSolvents + numPolymers + numMICPs
189  : std::numeric_limits<unsigned>::max();
190 
192  static constexpr unsigned saltConcentrationIdx =
193  enableBrine ? PVOffset + numPhases + numSolvents + numExtbos + numPolymers + numMICPs + numFoam
194  : std::numeric_limits<unsigned>::max();
195 
197  static constexpr unsigned temperatureIdx =
200  : std::numeric_limits<unsigned>::max();
201 
203  // Equation indices
205 
207  static constexpr int conti0EqIdx = PVOffset + 0;
208 
210  static constexpr int contiSolventEqIdx =
211  enableSolvent ? PVOffset + numPhases : -1000;
212 
214  static constexpr int contiZfracEqIdx =
215  enableExtbo ? PVOffset + numPhases + numSolvents : -1000;
216 
218  static constexpr int contiPolymerEqIdx =
219  enablePolymer ? PVOffset + numPhases + numSolvents : -1000;
220 
222  static constexpr int contiPolymerMWEqIdx =
223  numPolymers > 1 ? contiPolymerEqIdx + 1 : -1000;
224 
226  static constexpr int contiMicrobialEqIdx =
227  enableMICP ? PVOffset + numPhases + numSolvents : -1000;
228 
230  static constexpr int contiOxygenEqIdx =
231  numMICPs > 1 ? contiMicrobialEqIdx + 1 : -1000;
232 
234  static constexpr int contiUreaEqIdx =
235  numMICPs > 2 ? contiOxygenEqIdx + 1 : -1000;
236 
238  static constexpr int contiBiofilmEqIdx =
239  numMICPs > 3 ? contiUreaEqIdx + 1 : -1000;
240 
242  static constexpr int contiCalciteEqIdx =
243  numMICPs > 4 ? contiBiofilmEqIdx + 1 : -1000;
244 
246  static constexpr int contiFoamEqIdx =
247  enableFoam ? PVOffset + numPhases + numSolvents + numPolymers + numMICPs : -1000;
248 
250  static constexpr int contiBrineEqIdx =
251  enableBrine ? PVOffset + numPhases + numSolvents + numExtbos + numPolymers + numMICPs + numFoam : -1000;
252 
254  static constexpr int contiEnergyEqIdx =
256 };
257 
258 } // namespace Opm
259 
260 #endif
static constexpr unsigned saltConcentrationIdx
Index of the primary variable for the salt.
Definition: blackoilonephaseindices.hh:192
static constexpr unsigned polymerMoleWeightIdx
Index of the primary variable for the second polymer primary variable (molecular weight) ...
Definition: blackoilonephaseindices.hh:157
static constexpr int numBrine
Number of salt equations to be considered.
Definition: blackoilonephaseindices.hh:93
static constexpr unsigned pressureSwitchIdx
Index of the switching variable which determines the pressure.
Definition: blackoilonephaseindices.hh:131
static constexpr int numPhases
The number of fluid phases.
Definition: blackoilonephaseindices.hh:96
static constexpr int numEnergy
Number of energy equations to be considered.
Definition: blackoilonephaseindices.hh:87
The primary variable and equation indices for the black-oil model.
Definition: blackoilonephaseindices.hh:52
static constexpr int contiEnergyEqIdx
Index of the continuity equation for energy.
Definition: blackoilonephaseindices.hh:254
static constexpr int numEq
The number of equations.
Definition: blackoilonephaseindices.hh:105
static constexpr unsigned temperatureIdx
Index of the primary variable for temperature.
Definition: blackoilonephaseindices.hh:197
static constexpr unsigned biofilmVolumeFractionIdx
Index of the primary variable for the fourth MICP component.
Definition: blackoilonephaseindices.hh:177
static constexpr int contiBrineEqIdx
Index of the continuity equation for the salt component.
Definition: blackoilonephaseindices.hh:250
static constexpr bool enableSolvent
Are solvents involved?
Definition: blackoilonephaseindices.hh:60
static constexpr int contiCalciteEqIdx
Index of the continuity equation for the fifth MICP component.
Definition: blackoilonephaseindices.hh:242
static constexpr int contiUreaEqIdx
Index of the continuity equation for the third MICP component.
Definition: blackoilonephaseindices.hh:234
Structs needed for tpfalinearizer and its gpuparams struct extracted to be defined in one place that ...
Definition: blackoilbioeffectsmodules.hh:45
static constexpr unsigned ureaConcentrationIdx
Index of the primary variable for the third MICP component.
Definition: blackoilonephaseindices.hh:172
static constexpr int contiZfracEqIdx
Index of the continuity equation for the first extbo component.
Definition: blackoilonephaseindices.hh:214
static constexpr int numMICPs
Number of MICP components to be considered.
Definition: blackoilonephaseindices.hh:99
static constexpr int contiSolventEqIdx
Index of the continuity equation for the first solvent component.
Definition: blackoilonephaseindices.hh:210
static constexpr unsigned oxygenConcentrationIdx
Index of the primary variable for the second MICP component.
Definition: blackoilonephaseindices.hh:167
static constexpr bool enablePolymer
Are polymers involved?
Definition: blackoilonephaseindices.hh:66
static constexpr int contiPolymerEqIdx
Index of the continuity equation for the first polymer component.
Definition: blackoilonephaseindices.hh:218
static constexpr bool enableFullyImplicitThermal
Shall energy be conserved?
Definition: blackoilonephaseindices.hh:69
static constexpr bool enableExtbo
Is extbo invoked?
Definition: blackoilonephaseindices.hh:63
static constexpr int contiPolymerMWEqIdx
Index of the continuity equation for the second polymer component (molecular weight) ...
Definition: blackoilonephaseindices.hh:222
static constexpr int contiOxygenEqIdx
Index of the continuity equation for the second MICP component.
Definition: blackoilonephaseindices.hh:230
static constexpr bool oilEnabled
Is phase enabled or not.
Definition: blackoilonephaseindices.hh:55
static constexpr int conti0EqIdx
Index of the continuity equation of the first (and only) phase.
Definition: blackoilonephaseindices.hh:207
static constexpr unsigned microbialConcentrationIdx
Index of the primary variable for the first MICP component.
Definition: blackoilonephaseindices.hh:162
static constexpr int numBioInWat
Number of biocomponents in the water phase.
Definition: blackoilonephaseindices.hh:102
static constexpr int numExtbos
Number of components to be considered for extbo.
Definition: blackoilonephaseindices.hh:81
static constexpr bool enableMICP
Is MICP involved? (microbes, oxygen, urea, biofilm, and calcite)
Definition: blackoilonephaseindices.hh:72
static constexpr int numFoam
Number of foam equations to be considered.
Definition: blackoilonephaseindices.hh:90
static constexpr int numDerivatives
We may want to evaluate with more derivatives that equations, but not this time.
Definition: blackoilonephaseindices.hh:109
static constexpr unsigned zFractionIdx
Index of the primary variable for the first extbo component.
Definition: blackoilonephaseindices.hh:147
static constexpr unsigned compositionSwitchIdx
Index of the switching variable which determines the composition of the hydrocarbon phases...
Definition: blackoilonephaseindices.hh:139
static constexpr unsigned polymerConcentrationIdx
Index of the primary variable for the first polymer.
Definition: blackoilonephaseindices.hh:152
static constexpr int numSolvents
Number of solvent components to be considered.
Definition: blackoilonephaseindices.hh:78
static constexpr int contiBiofilmEqIdx
Index of the continuity equation for the fourth MICP component.
Definition: blackoilonephaseindices.hh:238
static constexpr int contiMicrobialEqIdx
Index of the continuity equation for the first MICP component.
Definition: blackoilonephaseindices.hh:226
static constexpr unsigned calciteVolumeFractionIdx
Index of the primary variable for the fifth MICP component.
Definition: blackoilonephaseindices.hh:182
static constexpr unsigned solventSaturationIdx
Index of the primary variable for the first solvent.
Definition: blackoilonephaseindices.hh:142
static constexpr unsigned foamConcentrationIdx
Index of the primary variable for the foam.
Definition: blackoilonephaseindices.hh:187
static constexpr int contiFoamEqIdx
Index of the continuity equation for the foam component.
Definition: blackoilonephaseindices.hh:246
static constexpr int numPolymers
Number of polymer components to be considered.
Definition: blackoilonephaseindices.hh:84
static constexpr bool enableBiofilm
Biofilm effects on co2/h2store only for two phase indices.
Definition: blackoilonephaseindices.hh:75
static constexpr unsigned waterSwitchIdx
Index of the switching variable which determines the composistion of the water phase.
Definition: blackoilonephaseindices.hh:123