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, unsigned numExtbosV, unsigned numPolymersV, unsigned numEnergyV, bool enableFoam, bool enableBrine, unsigned PVOffset, unsigned disabledCanonicalCompIdx, unsigned numMICPsV>
42{
44 static const bool oilEnabled = (disabledCanonicalCompIdx != 0);
45 static const bool waterEnabled = (disabledCanonicalCompIdx != 1);
46 static const bool gasEnabled = (disabledCanonicalCompIdx != 2);
47
49 static const bool enableSolvent = numSolventsV > 0;
50
52 static const bool enableExtbo = numExtbosV > 0;
53
55 static const bool enablePolymer = numPolymersV > 0;
56
58 static const bool enableEnergy = numEnergyV > 0;
59
61 static const bool enableMICP = numMICPsV > 0;
62
64 static const int numSolvents = enableSolvent ? numSolventsV : 0;
65
67 static const int numExtbos = enableExtbo ? numExtbosV : 0;
68
70 static const int numPolymers = enablePolymer ? numPolymersV : 0;
71
73 static const int numEnergy = enableEnergy ? numEnergyV : 0;
74
76 static const int numFoam = enableFoam? 1 : 0;
77
79 static const int numBrine = enableBrine? 1 : 0;
80
82 static const int numPhases = 2;
83
85 static const int numMICPs = enableMICP ? numMICPsV : 0;
86
89
91 // Primary variable indices
93
102 static const int waterSwitchIdx = waterEnabled ? PVOffset + 0 : -10000;
103
110 static const int pressureSwitchIdx = waterEnabled ? PVOffset + 1 : PVOffset + 0;
111
118 static const int compositionSwitchIdx = (gasEnabled && oilEnabled) ? PVOffset + 1 : -10000;
119
121 static const int solventSaturationIdx =
122 enableSolvent ? PVOffset + numPhases : -1000;
123
125 static const int zFractionIdx =
126 enableExtbo ? PVOffset + numPhases + numSolvents : -1000;
127
129 static const int polymerConcentrationIdx =
130 enablePolymer ? PVOffset + numPhases + numSolvents : -1000;
131
133 static const int polymerMoleWeightIdx =
134 numPolymers > 1 ? polymerConcentrationIdx + 1 : -1000;
135
137 static const int microbialConcentrationIdx =
138 enableMICP ? PVOffset + numPhases + numSolvents : -1000;
139
141 static const int oxygenConcentrationIdx =
142 numMICPs > 1 ? microbialConcentrationIdx + 1 : -1000;
143
145 static const int ureaConcentrationIdx =
146 numMICPs > 2 ? oxygenConcentrationIdx + 1 : -1000;
147
149 static const int biofilmConcentrationIdx =
150 numMICPs > 3 ? ureaConcentrationIdx + 1 : -1000;
151
153 static const int calciteConcentrationIdx =
154 numMICPs > 4 ? biofilmConcentrationIdx + 1 : -1000;
155
157 static const int foamConcentrationIdx =
158 enableFoam ? PVOffset + numPhases + numSolvents + numPolymers + numMICPs : -1000;
159
161 static const int saltConcentrationIdx =
162 enableBrine ? PVOffset + numPhases + numSolvents + numPolymers + numMICPs + numFoam : -1000;
163
165 static const int temperatureIdx =
167
169 // Equation indices
171
173 static unsigned canonicalToActiveComponentIndex(unsigned compIdx)
174 {
175 // assumes canonical oil = 0, water = 1, gas = 2;
176 if(!gasEnabled) {
177 assert(compIdx != 2);
178 // oil = 0, water = 1
179 return compIdx;
180 } else if (!waterEnabled) {
181 assert(compIdx != 1);
182 // oil = 0, gas = 1
183 return compIdx / 2;
184 } else {
185 assert(!oilEnabled);
186 assert(compIdx != 0);
187 }
188 // water = 0, gas = 1;
189 return compIdx-1;
190 }
191
192 static unsigned activeToCanonicalComponentIndex(unsigned compIdx)
193 {
194 // assumes canonical oil = 0, water = 1, gas = 2;
195 assert(compIdx < 2);
196 if(!gasEnabled) {
197 // oil = 0, water = 1
198 return compIdx;
199 } else if (!waterEnabled) {
200 // oil = 0, gas = 1
201 return compIdx * 2;
202 } else {
203 assert(!oilEnabled);
204 }
205 // water = 0, gas = 1;
206 return compIdx+1;
207 }
208
210 static const int conti0EqIdx = PVOffset + 0;
211 // one continuity equation follows
212
214 static const int contiSolventEqIdx =
215 enableSolvent ? PVOffset + numPhases : -1000;
216
218 static const int contiZfracEqIdx =
219 enableExtbo ? PVOffset + numPhases + numSolvents : -1000;
220
222 static const int contiPolymerEqIdx =
223 enablePolymer ? PVOffset + numPhases + numSolvents : -1000;
224
226 static const int contiPolymerMWEqIdx =
227 numPolymers > 1 ? contiPolymerEqIdx + 1 : -1000;
228
230 static const int contiMicrobialEqIdx =
231 enableMICP ? PVOffset + numPhases + numSolvents : -1000;
232
234 static const int contiOxygenEqIdx =
235 numMICPs > 1 ? contiMicrobialEqIdx + 1 : -1000;
236
238 static const int contiUreaEqIdx =
239 numMICPs > 2 ? contiOxygenEqIdx + 1 : -1000;
240
242 static const int contiBiofilmEqIdx =
243 numMICPs > 3 ? contiUreaEqIdx + 1 : -1000;
244
246 static const int contiCalciteEqIdx =
247 numMICPs > 4 ? contiBiofilmEqIdx + 1 : -1000;
248
250 static const int contiFoamEqIdx =
251 enableFoam ? PVOffset + numPhases + numSolvents + numPolymers + numMICPs : -1000;
252
254 static const int contiBrineEqIdx =
255 enableBrine ? PVOffset + numPhases + numSolvents + numPolymers + numMICPs + numFoam : -1000;
256
258 static const int contiEnergyEqIdx =
260};
261
262} // namespace Opm
263
264#endif
Definition: blackoilboundaryratevector.hh:37
The primary variable and equation indices for the black-oil model.
Definition: blackoiltwophaseindices.hh:42
static const int numSolvents
Number of solvent components to be considered.
Definition: blackoiltwophaseindices.hh:64
static const int numPolymers
Number of polymer components to be considered.
Definition: blackoiltwophaseindices.hh:70
static const int contiPolymerEqIdx
Index of the continuity equation for the first polymer component.
Definition: blackoiltwophaseindices.hh:222
static const int calciteConcentrationIdx
Index of the primary variable for the fifth MICP component.
Definition: blackoiltwophaseindices.hh:153
static const bool waterEnabled
Definition: blackoiltwophaseindices.hh:45
static const int contiUreaEqIdx
Index of the continuity equation for the third MICP component.
Definition: blackoiltwophaseindices.hh:238
static const int ureaConcentrationIdx
Index of the primary variable for the third MICP component.
Definition: blackoiltwophaseindices.hh:145
static const int solventSaturationIdx
Index of the primary variable for the first solvent.
Definition: blackoiltwophaseindices.hh:121
static const int contiSolventEqIdx
Index of the continuity equation for the first solvent component.
Definition: blackoiltwophaseindices.hh:214
static const int microbialConcentrationIdx
Index of the primary variable for the first MICP component.
Definition: blackoiltwophaseindices.hh:137
static const int polymerConcentrationIdx
Index of the primary variable for the first polymer.
Definition: blackoiltwophaseindices.hh:129
static unsigned activeToCanonicalComponentIndex(unsigned compIdx)
Definition: blackoiltwophaseindices.hh:192
static const int contiBrineEqIdx
Index of the continuity equation for the salt component.
Definition: blackoiltwophaseindices.hh:254
static const int polymerMoleWeightIdx
Index of the primary variable for the second polymer primary variable (molecular weight)
Definition: blackoiltwophaseindices.hh:133
static const bool oilEnabled
Is phase enabled or not.
Definition: blackoiltwophaseindices.hh:44
static const int conti0EqIdx
Index of the continuity equation of the first phase.
Definition: blackoiltwophaseindices.hh:210
static const int zFractionIdx
Index of the primary variable for the first extbo component.
Definition: blackoiltwophaseindices.hh:125
static const int numFoam
Number of foam equations to be considered.
Definition: blackoiltwophaseindices.hh:76
static const int temperatureIdx
Index of the primary variable for temperature.
Definition: blackoiltwophaseindices.hh:165
static const int compositionSwitchIdx
Index of the switching variable which determines the composition of the hydrocarbon phases.
Definition: blackoiltwophaseindices.hh:118
static const int biofilmConcentrationIdx
Index of the primary variable for the fourth MICP component.
Definition: blackoiltwophaseindices.hh:149
static const int contiZfracEqIdx
Index of the continuity equation for the first extbo component.
Definition: blackoiltwophaseindices.hh:218
static const bool enableSolvent
Are solvents involved?
Definition: blackoiltwophaseindices.hh:49
static const int contiPolymerMWEqIdx
Index of the continuity equation for the second polymer component (molecular weight)
Definition: blackoiltwophaseindices.hh:226
static const int saltConcentrationIdx
Index of the primary variable for the salt.
Definition: blackoiltwophaseindices.hh:161
static const int contiEnergyEqIdx
Index of the continuity equation for energy.
Definition: blackoiltwophaseindices.hh:258
static const int numEq
The number of equations.
Definition: blackoiltwophaseindices.hh:88
static const bool enableMICP
Is MICP involved?
Definition: blackoiltwophaseindices.hh:61
static const int numBrine
Number of salt equations to be considered.
Definition: blackoiltwophaseindices.hh:79
static const int numEnergy
Number of energy equations to be considered.
Definition: blackoiltwophaseindices.hh:73
static const int contiBiofilmEqIdx
Index of the continuity equation for the fourth MICP component.
Definition: blackoiltwophaseindices.hh:242
static const int contiOxygenEqIdx
Index of the continuity equation for the second MICP component.
Definition: blackoiltwophaseindices.hh:234
static const int contiFoamEqIdx
Index of the continuity equation for the foam component.
Definition: blackoiltwophaseindices.hh:250
static const bool enablePolymer
Are polymers involved?
Definition: blackoiltwophaseindices.hh:55
static const int foamConcentrationIdx
Index of the primary variable for the foam.
Definition: blackoiltwophaseindices.hh:157
static const int oxygenConcentrationIdx
Index of the primary variable for the second MICP component.
Definition: blackoiltwophaseindices.hh:141
static const bool gasEnabled
Definition: blackoiltwophaseindices.hh:46
static const bool enableExtbo
Is extbo invoked?
Definition: blackoiltwophaseindices.hh:52
static const int contiMicrobialEqIdx
Index of the continuity equation for the first MICP component.
Definition: blackoiltwophaseindices.hh:230
static const int numMICPs
Number of MICP components to be considered.
Definition: blackoiltwophaseindices.hh:85
static const int numExtbos
Number of components to be considered for extbo.
Definition: blackoiltwophaseindices.hh:67
static const bool enableEnergy
Shall energy be conserved?
Definition: blackoiltwophaseindices.hh:58
static unsigned canonicalToActiveComponentIndex(unsigned compIdx)
returns the index of "active" component
Definition: blackoiltwophaseindices.hh:173
static const int pressureSwitchIdx
Index of the switching variable which determines the pressure.
Definition: blackoiltwophaseindices.hh:110
static const int numPhases
The number of fluid phases.
Definition: blackoiltwophaseindices.hh:82
static const int contiCalciteEqIdx
Index of the continuity equation for the fifth MICP component.
Definition: blackoiltwophaseindices.hh:246
static const int waterSwitchIdx
Index of the switching variable which determines the composistion of the water phase.
Definition: blackoiltwophaseindices.hh:102