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
33#include <opm/common/utility/ConstexprAssert.hpp>
34
35namespace Opm {
36
42template<unsigned numSolventsV,
43 unsigned numExtbosV,
44 unsigned numPolymersV,
45 unsigned numEnergyV,
46 bool enableFoam,
47 bool enableBrine,
48 unsigned PVOffset,
49 unsigned canonicalCompIdx,
50 unsigned numMICPsV>
52{
54 static constexpr bool oilEnabled = canonicalCompIdx == 0;
55 static constexpr bool waterEnabled = canonicalCompIdx == 1;
56 static constexpr bool gasEnabled = canonicalCompIdx == 2;
57
59 static constexpr bool enableSolvent = numSolventsV > 0;
60
62 static constexpr bool enableExtbo = numExtbosV > 0;
63
65 static constexpr bool enablePolymer = numPolymersV > 0;
66
68 static constexpr bool enableEnergy = numEnergyV > 0;
69
71 static constexpr bool enableMICP = numMICPsV > 0;
72
74 static constexpr int numSolvents = enableSolvent ? numSolventsV : 0;
75
77 static constexpr int numExtbos = enableExtbo ? numExtbosV : 0;
78
80 static constexpr int numPolymers = enablePolymer ? numPolymersV : 0;
81
83 static constexpr int numEnergy = enableEnergy ? numEnergyV : 0;
84
86 static constexpr int numFoam = enableFoam? 1 : 0;
87
89 static constexpr int numBrine = enableBrine? 1 : 0;
90
92 static constexpr int numPhases = 1;
93
95 static constexpr int numMICPs = enableMICP ? numMICPsV : 0;
96
98 static constexpr int numEq = numPhases + numSolvents + numExtbos + numPolymers +
100
102 // Primary variable indices
104
113 static constexpr int waterSwitchIdx = -10000;
114
121 static constexpr int pressureSwitchIdx = PVOffset + 0;
122
129 static constexpr int compositionSwitchIdx = -10000;
130
132 static constexpr int solventSaturationIdx =
133 enableSolvent ? PVOffset + numPhases : -1000;
134
136 static constexpr int zFractionIdx =
137 enableExtbo ? PVOffset + numPhases + numSolvents : -1000;
138
140 static constexpr int polymerConcentrationIdx =
141 enablePolymer ? PVOffset + numPhases + numSolvents : -1000;
142
144 static constexpr int polymerMoleWeightIdx =
145 numPolymers > 1 ? polymerConcentrationIdx + 1 : -1000;
146
148 static constexpr int microbialConcentrationIdx =
149 enableMICP ? PVOffset + numPhases + numSolvents : -1000;
150
152 static constexpr int oxygenConcentrationIdx =
153 numMICPs > 1 ? microbialConcentrationIdx + 1 : -1000;
154
156 static constexpr int ureaConcentrationIdx =
157 numMICPs > 2 ? oxygenConcentrationIdx + 1 : -1000;
158
160 static constexpr int biofilmConcentrationIdx =
161 numMICPs > 3 ? ureaConcentrationIdx + 1 : -1000;
162
164 static constexpr int calciteConcentrationIdx =
165 numMICPs > 4 ? biofilmConcentrationIdx + 1 : -1000;
166
168 static constexpr int foamConcentrationIdx =
169 enableFoam ? PVOffset + numPhases + numSolvents + numPolymers + numMICPs : -1000;
170
172 static constexpr int saltConcentrationIdx =
173 enableBrine ? PVOffset + numPhases + numSolvents + numExtbos + numPolymers + numMICPs + numFoam : -1000;
174
176 static constexpr int temperatureIdx =
178
180 // Equation indices
182
184 static constexpr int canonicalToActiveComponentIndex(const int /*compIdx*/)
185 {
186 return 0;
187 }
188
189 static constexpr int activeToCanonicalComponentIndex([[maybe_unused]] const int compIdx)
190 {
191 // assumes canonical oil = 0, water = 1, gas = 2;
192 constexpr_assert(compIdx == 0);
193 if (gasEnabled) {
194 return 2;
195 } else if (waterEnabled) {
196 return 1;
197 } else {
198 assert(oilEnabled);
199 }
200
201 return 0;
202 }
203
205 static constexpr int conti0EqIdx = PVOffset + 0;
206
208 static constexpr int contiSolventEqIdx =
209 enableSolvent ? PVOffset + numPhases : -1000;
210
212 static constexpr int contiZfracEqIdx =
213 enableExtbo ? PVOffset + numPhases + numSolvents : -1000;
214
216 static constexpr int contiPolymerEqIdx =
217 enablePolymer ? PVOffset + numPhases + numSolvents : -1000;
218
220 static constexpr int contiPolymerMWEqIdx =
221 numPolymers > 1 ? contiPolymerEqIdx + 1 : -1000;
222
224 static constexpr int contiMicrobialEqIdx =
225 enableMICP ? PVOffset + numPhases + numSolvents : -1000;
226
228 static constexpr int contiOxygenEqIdx =
229 numMICPs > 1 ? contiMicrobialEqIdx + 1 : -1000;
230
232 static constexpr int contiUreaEqIdx =
233 numMICPs > 2 ? contiOxygenEqIdx + 1 : -1000;
234
236 static constexpr int contiBiofilmEqIdx =
237 numMICPs > 3 ? contiUreaEqIdx + 1 : -1000;
238
240 static constexpr int contiCalciteEqIdx =
241 numMICPs > 4 ? contiBiofilmEqIdx + 1 : -1000;
242
244 static constexpr int contiFoamEqIdx =
245 enableFoam ? PVOffset + numPhases + numSolvents + numPolymers + numMICPs : -1000;
246
248 static constexpr int contiBrineEqIdx =
249 enableBrine ? PVOffset + numPhases + numSolvents + numExtbos + numPolymers + numMICPs + numFoam : -1000;
250
252 static constexpr int contiEnergyEqIdx =
254};
255
256} // namespace Opm
257
258#endif
Definition: blackoilboundaryratevector.hh:39
The primary variable and equation indices for the black-oil model.
Definition: blackoilonephaseindices.hh:52
static constexpr int canonicalToActiveComponentIndex(const int)
returns the index of "active" component
Definition: blackoilonephaseindices.hh:184
static constexpr int activeToCanonicalComponentIndex(const int compIdx)
Definition: blackoilonephaseindices.hh:189
static constexpr bool waterEnabled
Definition: blackoilonephaseindices.hh:55
static constexpr int numEq
The number of equations.
Definition: blackoilonephaseindices.hh:98
static constexpr bool oilEnabled
Is phase enabled or not.
Definition: blackoilonephaseindices.hh:54
static constexpr int numPolymers
Number of polymer components to be considered.
Definition: blackoilonephaseindices.hh:80
static constexpr int numMICPs
Number of MICP components to be considered.
Definition: blackoilonephaseindices.hh:95
static constexpr int contiOxygenEqIdx
Index of the continuity equation for the second MICP component.
Definition: blackoilonephaseindices.hh:228
static constexpr int solventSaturationIdx
Index of the primary variable for the first solvent.
Definition: blackoilonephaseindices.hh:132
static constexpr int oxygenConcentrationIdx
Index of the primary variable for the second MICP component.
Definition: blackoilonephaseindices.hh:152
static constexpr int ureaConcentrationIdx
Index of the primary variable for the third MICP component.
Definition: blackoilonephaseindices.hh:156
static constexpr int contiPolymerMWEqIdx
Index of the continuity equation for the second polymer component (molecular weight)
Definition: blackoilonephaseindices.hh:220
static constexpr int numFoam
Number of foam equations to be considered.
Definition: blackoilonephaseindices.hh:86
static constexpr int foamConcentrationIdx
Index of the primary variable for the foam.
Definition: blackoilonephaseindices.hh:168
static constexpr int numSolvents
Number of solvent components to be considered.
Definition: blackoilonephaseindices.hh:74
static constexpr int numPhases
The number of fluid phases.
Definition: blackoilonephaseindices.hh:92
static constexpr int polymerConcentrationIdx
Index of the primary variable for the first polymer.
Definition: blackoilonephaseindices.hh:140
static constexpr int contiBrineEqIdx
Index of the continuity equation for the salt component.
Definition: blackoilonephaseindices.hh:248
static constexpr bool enableSolvent
Are solvents involved?
Definition: blackoilonephaseindices.hh:59
static constexpr int contiFoamEqIdx
Index of the continuity equation for the foam component.
Definition: blackoilonephaseindices.hh:244
static constexpr int contiZfracEqIdx
Index of the continuity equation for the first extbo component.
Definition: blackoilonephaseindices.hh:212
static constexpr int compositionSwitchIdx
Index of the switching variable which determines the composition of the hydrocarbon phases.
Definition: blackoilonephaseindices.hh:129
static constexpr int zFractionIdx
Index of the primary variable for the first extbo component.
Definition: blackoilonephaseindices.hh:136
static constexpr bool enableExtbo
Is extbo invoked?
Definition: blackoilonephaseindices.hh:62
static constexpr int saltConcentrationIdx
Index of the primary variable for the salt.
Definition: blackoilonephaseindices.hh:172
static constexpr bool enablePolymer
Are polymers involved?
Definition: blackoilonephaseindices.hh:65
static constexpr int pressureSwitchIdx
Index of the switching variable which determines the pressure.
Definition: blackoilonephaseindices.hh:121
static constexpr int contiMicrobialEqIdx
Index of the continuity equation for the first MICP component.
Definition: blackoilonephaseindices.hh:224
static constexpr int temperatureIdx
Index of the primary variable for temperature.
Definition: blackoilonephaseindices.hh:176
static constexpr int contiCalciteEqIdx
Index of the continuity equation for the fifth MICP component.
Definition: blackoilonephaseindices.hh:240
static constexpr int contiUreaEqIdx
Index of the continuity equation for the third MICP component.
Definition: blackoilonephaseindices.hh:232
static constexpr bool enableEnergy
Shall energy be conserved?
Definition: blackoilonephaseindices.hh:68
static constexpr int contiEnergyEqIdx
Index of the continuity equation for energy.
Definition: blackoilonephaseindices.hh:252
static constexpr int contiPolymerEqIdx
Index of the continuity equation for the first polymer component.
Definition: blackoilonephaseindices.hh:216
static constexpr int numEnergy
Number of energy equations to be considered.
Definition: blackoilonephaseindices.hh:83
static constexpr int numExtbos
Number of components to be considered for extbo.
Definition: blackoilonephaseindices.hh:77
static constexpr int contiSolventEqIdx
Index of the continuity equation for the first solvent component.
Definition: blackoilonephaseindices.hh:208
static constexpr int biofilmConcentrationIdx
Index of the primary variable for the fourth MICP component.
Definition: blackoilonephaseindices.hh:160
static constexpr bool gasEnabled
Definition: blackoilonephaseindices.hh:56
static constexpr int polymerMoleWeightIdx
Index of the primary variable for the second polymer primary variable (molecular weight)
Definition: blackoilonephaseindices.hh:144
static constexpr int calciteConcentrationIdx
Index of the primary variable for the fifth MICP component.
Definition: blackoilonephaseindices.hh:164
static constexpr int conti0EqIdx
Index of the continuity equation of the first (and only) phase.
Definition: blackoilonephaseindices.hh:205
static constexpr int contiBiofilmEqIdx
Index of the continuity equation for the fourth MICP component.
Definition: blackoilonephaseindices.hh:236
static constexpr int waterSwitchIdx
Index of the switching variable which determines the composistion of the water phase.
Definition: blackoilonephaseindices.hh:113
static constexpr int microbialConcentrationIdx
Index of the primary variable for the first MICP component.
Definition: blackoilonephaseindices.hh:148
static constexpr int numBrine
Number of salt equations to be considered.
Definition: blackoilonephaseindices.hh:89
static constexpr bool enableMICP
Is MICP involved?
Definition: blackoilonephaseindices.hh:71