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 <cassert>
32
33namespace Opm {
34
40template<unsigned numSolventsV,
41 unsigned numExtbosV,
42 unsigned numPolymersV,
43 unsigned numEnergyV,
44 bool enableFoam,
45 bool enableBrine,
46 unsigned PVOffset,
47 unsigned disabledCanonicalCompIdx,
48 unsigned numMICPsV>
50{
52 static constexpr bool oilEnabled = disabledCanonicalCompIdx != 0;
53 static constexpr bool waterEnabled = disabledCanonicalCompIdx != 1;
54 static constexpr bool gasEnabled = disabledCanonicalCompIdx != 2;
55
57 static constexpr bool enableSolvent = numSolventsV > 0;
58
60 static constexpr bool enableExtbo = numExtbosV > 0;
61
63 static constexpr bool enablePolymer = numPolymersV > 0;
64
66 static constexpr bool enableEnergy = numEnergyV > 0;
67
69 static constexpr bool enableMICP = numMICPsV > 0;
70
72 static constexpr int numSolvents = enableSolvent ? numSolventsV : 0;
73
75 static constexpr int numExtbos = enableExtbo ? numExtbosV : 0;
76
78 static constexpr int numPolymers = enablePolymer ? numPolymersV : 0;
79
81 static constexpr int numEnergy = enableEnergy ? numEnergyV : 0;
82
84 static constexpr int numFoam = enableFoam? 1 : 0;
85
87 static constexpr int numBrine = enableBrine? 1 : 0;
88
90 static constexpr int numPhases = 2;
91
93 static constexpr int numMICPs = enableMICP ? numMICPsV : 0;
94
96 static constexpr int numEq = numPhases + numSolvents + numExtbos + numPolymers +
98
100 // Primary variable indices
102
111 static constexpr int waterSwitchIdx = waterEnabled ? PVOffset + 0 : -10000;
112
119 static constexpr int pressureSwitchIdx = waterEnabled ? PVOffset + 1 : PVOffset + 0;
120
127 static constexpr int compositionSwitchIdx = (gasEnabled && oilEnabled) ? PVOffset + 1 : -10000;
128
130 static constexpr int solventSaturationIdx =
131 enableSolvent ? PVOffset + numPhases : -1000;
132
134 static constexpr int zFractionIdx =
135 enableExtbo ? PVOffset + numPhases + numSolvents : -1000;
136
138 static constexpr int polymerConcentrationIdx =
139 enablePolymer ? PVOffset + numPhases + numSolvents : -1000;
140
142 static constexpr int polymerMoleWeightIdx =
143 numPolymers > 1 ? polymerConcentrationIdx + 1 : -1000;
144
146 static constexpr int microbialConcentrationIdx =
147 enableMICP ? PVOffset + numPhases + numSolvents : -1000;
148
150 static constexpr int oxygenConcentrationIdx =
151 numMICPs > 1 ? microbialConcentrationIdx + 1 : -1000;
152
154 static constexpr int ureaConcentrationIdx =
155 numMICPs > 2 ? oxygenConcentrationIdx + 1 : -1000;
156
158 static constexpr int biofilmConcentrationIdx =
159 numMICPs > 3 ? ureaConcentrationIdx + 1 : -1000;
160
162 static constexpr int calciteConcentrationIdx =
163 numMICPs > 4 ? biofilmConcentrationIdx + 1 : -1000;
164
166 static constexpr int foamConcentrationIdx =
167 enableFoam ? PVOffset + numPhases + numSolvents + numPolymers + numMICPs : -1000;
168
170 static constexpr int saltConcentrationIdx =
171 enableBrine ? PVOffset + numPhases + numSolvents + numPolymers + numMICPs + numFoam : -1000;
172
174 static constexpr int temperatureIdx =
176
178 // Equation indices
180
182 static unsigned canonicalToActiveComponentIndex(unsigned compIdx)
183 {
184 // assumes canonical oil = 0, water = 1, gas = 2;
185 if (!gasEnabled) {
186 assert(compIdx != 2);
187 // oil = 0, water = 1
188 return compIdx;
189 } else if (!waterEnabled) {
190 assert(compIdx != 1);
191 // oil = 0, gas = 1
192 return compIdx / 2;
193 } else {
194 assert(!oilEnabled);
195 assert(compIdx != 0);
196 }
197
198 // water = 0, gas = 1;
199 return compIdx - 1;
200 }
201
202 static unsigned activeToCanonicalComponentIndex(unsigned compIdx)
203 {
204 // assumes canonical oil = 0, water = 1, gas = 2;
205 assert(compIdx < 2);
206 if (!gasEnabled) {
207 // oil = 0, water = 1
208 return compIdx;
209 } else if (!waterEnabled) {
210 // oil = 0, gas = 1
211 return compIdx * 2;
212 } else {
213 assert(!oilEnabled);
214 }
215
216 // water = 0, gas = 1;
217 return compIdx + 1;
218 }
219
221 static constexpr int conti0EqIdx = PVOffset + 0;
222 // one continuity equation follows
223
225 static constexpr int contiSolventEqIdx =
226 enableSolvent ? PVOffset + numPhases : -1000;
227
229 static constexpr int contiZfracEqIdx =
230 enableExtbo ? PVOffset + numPhases + numSolvents : -1000;
231
233 static constexpr int contiPolymerEqIdx =
234 enablePolymer ? PVOffset + numPhases + numSolvents : -1000;
235
237 static constexpr int contiPolymerMWEqIdx =
238 numPolymers > 1 ? contiPolymerEqIdx + 1 : -1000;
239
241 static constexpr int contiMicrobialEqIdx =
242 enableMICP ? PVOffset + numPhases + numSolvents : -1000;
243
245 static constexpr int contiOxygenEqIdx =
246 numMICPs > 1 ? contiMicrobialEqIdx + 1 : -1000;
247
249 static constexpr int contiUreaEqIdx =
250 numMICPs > 2 ? contiOxygenEqIdx + 1 : -1000;
251
253 static constexpr int contiBiofilmEqIdx =
254 numMICPs > 3 ? contiUreaEqIdx + 1 : -1000;
255
257 static constexpr int contiCalciteEqIdx =
258 numMICPs > 4 ? contiBiofilmEqIdx + 1 : -1000;
259
261 static constexpr int contiFoamEqIdx =
262 enableFoam ? PVOffset + numPhases + numSolvents + numPolymers + numMICPs : -1000;
263
265 static constexpr int contiBrineEqIdx =
266 enableBrine ? PVOffset + numPhases + numSolvents + numPolymers + numMICPs + numFoam : -1000;
267
269 static constexpr int contiEnergyEqIdx =
271};
272
273} // namespace Opm
274
275#endif
Definition: blackoilboundaryratevector.hh:37
The primary variable and equation indices for the black-oil model.
Definition: blackoiltwophaseindices.hh:50
static constexpr bool waterEnabled
Definition: blackoiltwophaseindices.hh:53
static constexpr int conti0EqIdx
Index of the continuity equation of the first phase.
Definition: blackoiltwophaseindices.hh:221
static constexpr int contiCalciteEqIdx
Index of the continuity equation for the fifth MICP component.
Definition: blackoiltwophaseindices.hh:257
static constexpr int contiFoamEqIdx
Index of the continuity equation for the foam component.
Definition: blackoiltwophaseindices.hh:261
static constexpr int ureaConcentrationIdx
Index of the primary variable for the third MICP component.
Definition: blackoiltwophaseindices.hh:154
static constexpr int biofilmConcentrationIdx
Index of the primary variable for the fourth MICP component.
Definition: blackoiltwophaseindices.hh:158
static constexpr int contiMicrobialEqIdx
Index of the continuity equation for the first MICP component.
Definition: blackoiltwophaseindices.hh:241
static constexpr int contiOxygenEqIdx
Index of the continuity equation for the second MICP component.
Definition: blackoiltwophaseindices.hh:245
static constexpr bool enablePolymer
Are polymers involved?
Definition: blackoiltwophaseindices.hh:63
static constexpr int temperatureIdx
Index of the primary variable for temperature.
Definition: blackoiltwophaseindices.hh:174
static constexpr int numEq
The number of equations.
Definition: blackoiltwophaseindices.hh:96
static constexpr bool enableSolvent
Are solvents involved?
Definition: blackoiltwophaseindices.hh:57
static constexpr bool oilEnabled
Is phase enabled or not.
Definition: blackoiltwophaseindices.hh:52
static constexpr bool enableEnergy
Shall energy be conserved?
Definition: blackoiltwophaseindices.hh:66
static constexpr int contiBiofilmEqIdx
Index of the continuity equation for the fourth MICP component.
Definition: blackoiltwophaseindices.hh:253
static constexpr int numBrine
Number of salt equations to be considered.
Definition: blackoiltwophaseindices.hh:87
static unsigned activeToCanonicalComponentIndex(unsigned compIdx)
Definition: blackoiltwophaseindices.hh:202
static constexpr int contiBrineEqIdx
Index of the continuity equation for the salt component.
Definition: blackoiltwophaseindices.hh:265
static constexpr int polymerConcentrationIdx
Index of the primary variable for the first polymer.
Definition: blackoiltwophaseindices.hh:138
static constexpr int numSolvents
Number of solvent components to be considered.
Definition: blackoiltwophaseindices.hh:72
static constexpr int numPolymers
Number of polymer components to be considered.
Definition: blackoiltwophaseindices.hh:78
static constexpr bool gasEnabled
Definition: blackoiltwophaseindices.hh:54
static constexpr int compositionSwitchIdx
Index of the switching variable which determines the composition of the hydrocarbon phases.
Definition: blackoiltwophaseindices.hh:127
static constexpr int polymerMoleWeightIdx
Index of the primary variable for the second polymer primary variable (molecular weight)
Definition: blackoiltwophaseindices.hh:142
static constexpr int calciteConcentrationIdx
Index of the primary variable for the fifth MICP component.
Definition: blackoiltwophaseindices.hh:162
static constexpr int foamConcentrationIdx
Index of the primary variable for the foam.
Definition: blackoiltwophaseindices.hh:166
static constexpr bool enableExtbo
Is extbo invoked?
Definition: blackoiltwophaseindices.hh:60
static constexpr int numMICPs
Number of MICP components to be considered.
Definition: blackoiltwophaseindices.hh:93
static constexpr int contiPolymerEqIdx
Index of the continuity equation for the first polymer component.
Definition: blackoiltwophaseindices.hh:233
static constexpr int contiEnergyEqIdx
Index of the continuity equation for energy.
Definition: blackoiltwophaseindices.hh:269
static constexpr int contiPolymerMWEqIdx
Index of the continuity equation for the second polymer component (molecular weight)
Definition: blackoiltwophaseindices.hh:237
static constexpr bool enableMICP
Is MICP involved?
Definition: blackoiltwophaseindices.hh:69
static constexpr int oxygenConcentrationIdx
Index of the primary variable for the second MICP component.
Definition: blackoiltwophaseindices.hh:150
static constexpr int numFoam
Number of foam equations to be considered.
Definition: blackoiltwophaseindices.hh:84
static constexpr int pressureSwitchIdx
Index of the switching variable which determines the pressure.
Definition: blackoiltwophaseindices.hh:119
static constexpr int numEnergy
Number of energy equations to be considered.
Definition: blackoiltwophaseindices.hh:81
static constexpr int contiUreaEqIdx
Index of the continuity equation for the third MICP component.
Definition: blackoiltwophaseindices.hh:249
static constexpr int microbialConcentrationIdx
Index of the primary variable for the first MICP component.
Definition: blackoiltwophaseindices.hh:146
static constexpr int numExtbos
Number of components to be considered for extbo.
Definition: blackoiltwophaseindices.hh:75
static unsigned canonicalToActiveComponentIndex(unsigned compIdx)
returns the index of "active" component
Definition: blackoiltwophaseindices.hh:182
static constexpr int solventSaturationIdx
Index of the primary variable for the first solvent.
Definition: blackoiltwophaseindices.hh:130
static constexpr int contiZfracEqIdx
Index of the continuity equation for the first extbo component.
Definition: blackoiltwophaseindices.hh:229
static constexpr int zFractionIdx
Index of the primary variable for the first extbo component.
Definition: blackoiltwophaseindices.hh:134
static constexpr int saltConcentrationIdx
Index of the primary variable for the salt.
Definition: blackoiltwophaseindices.hh:170
static constexpr int contiSolventEqIdx
Index of the continuity equation for the first solvent component.
Definition: blackoiltwophaseindices.hh:225
static constexpr int numPhases
The number of fluid phases.
Definition: blackoiltwophaseindices.hh:90
static constexpr int waterSwitchIdx
Index of the switching variable which determines the composistion of the water phase.
Definition: blackoiltwophaseindices.hh:111