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
33namespace Opm {
34
40template <unsigned numSolventsV, unsigned numExtbosV, unsigned numPolymersV, unsigned numEnergyV, bool enableFoam, bool enableBrine, unsigned PVOffset, unsigned canonicalCompIdx, unsigned numMICPsV>
42{
44 static const bool oilEnabled = (canonicalCompIdx == 0);
45 static const bool waterEnabled = (canonicalCompIdx == 1);
46 static const bool gasEnabled = (canonicalCompIdx == 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 = 1;
83
85 static const int numMICPs = enableMICP ? numMICPsV : 0;
86
89
91 // Primary variable indices
93
102 static const int waterSwitchIdx = -10000;
103
110 static const int pressureSwitchIdx = PVOffset + 0;
111
118 static const int compositionSwitchIdx = -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 + numExtbos + numPolymers + numMICPs + numFoam : -1000;
163
165 static const int temperatureIdx =
167
169 // Equation indices
171
173 static unsigned canonicalToActiveComponentIndex(unsigned /*compIdx*/)
174 {
175 return 0;
176 }
177
178 static unsigned activeToCanonicalComponentIndex([[maybe_unused]] unsigned compIdx)
179 {
180 // assumes canonical oil = 0, water = 1, gas = 2;
181 assert(compIdx == 0);
182 if(gasEnabled) {
183 return 2;
184 } else if (waterEnabled) {
185 return 1;
186 } else {
187 assert(oilEnabled);
188 }
189 return 0;
190 }
191
193 static const int conti0EqIdx = PVOffset + 0;
194
196 static const int contiSolventEqIdx =
197 enableSolvent ? PVOffset + numPhases : -1000;
198
200 static const int contiZfracEqIdx =
201 enableExtbo ? PVOffset + numPhases + numSolvents : -1000;
202
204 static const int contiPolymerEqIdx =
205 enablePolymer ? PVOffset + numPhases + numSolvents : -1000;
206
208 static const int contiPolymerMWEqIdx =
209 numPolymers > 1 ? contiPolymerEqIdx + 1 : -1000;
210
212 static const int contiMicrobialEqIdx =
213 enableMICP ? PVOffset + numPhases + numSolvents : -1000;
214
216 static const int contiOxygenEqIdx =
217 numMICPs > 1 ? contiMicrobialEqIdx + 1 : -1000;
218
220 static const int contiUreaEqIdx =
221 numMICPs > 2 ? contiOxygenEqIdx + 1 : -1000;
222
224 static const int contiBiofilmEqIdx =
225 numMICPs > 3 ? contiUreaEqIdx + 1 : -1000;
226
228 static const int contiCalciteEqIdx =
229 numMICPs > 4 ? contiBiofilmEqIdx + 1 : -1000;
230
232 static const int contiFoamEqIdx =
233 enableFoam ? PVOffset + numPhases + numSolvents + numPolymers + numMICPs : -1000;
234
236 static const int contiBrineEqIdx =
237 enableBrine ? PVOffset + numPhases + numSolvents + numExtbos + numPolymers + numMICPs + numFoam : -1000;
238
240 static const int contiEnergyEqIdx =
242};
243
244} // namespace Opm
245
246#endif
Definition: blackoilboundaryratevector.hh:37
The primary variable and equation indices for the black-oil model.
Definition: blackoilonephaseindices.hh:42
static const int contiFoamEqIdx
Index of the continuity equation for the foam component.
Definition: blackoilonephaseindices.hh:232
static const int calciteConcentrationIdx
Index of the primary variable for the fifth MICP component.
Definition: blackoilonephaseindices.hh:153
static const int pressureSwitchIdx
Index of the switching variable which determines the pressure.
Definition: blackoilonephaseindices.hh:110
static const bool enableMICP
Is MICP involved?
Definition: blackoilonephaseindices.hh:61
static const int solventSaturationIdx
Index of the primary variable for the first solvent.
Definition: blackoilonephaseindices.hh:121
static const bool enableEnergy
Shall energy be conserved?
Definition: blackoilonephaseindices.hh:58
static const int contiPolymerMWEqIdx
Index of the continuity equation for the second polymer component (molecular weight)
Definition: blackoilonephaseindices.hh:208
static unsigned activeToCanonicalComponentIndex(unsigned compIdx)
Definition: blackoilonephaseindices.hh:178
static const int waterSwitchIdx
Index of the switching variable which determines the composistion of the water phase.
Definition: blackoilonephaseindices.hh:102
static const int numPhases
The number of fluid phases.
Definition: blackoilonephaseindices.hh:82
static const int biofilmConcentrationIdx
Index of the primary variable for the fourth MICP component.
Definition: blackoilonephaseindices.hh:149
static const int contiSolventEqIdx
Index of the continuity equation for the first solvent component.
Definition: blackoilonephaseindices.hh:196
static const int ureaConcentrationIdx
Index of the primary variable for the third MICP component.
Definition: blackoilonephaseindices.hh:145
static const int saltConcentrationIdx
Index of the primary variable for the salt.
Definition: blackoilonephaseindices.hh:161
static const int numPolymers
Number of polymer components to be considered.
Definition: blackoilonephaseindices.hh:70
static unsigned canonicalToActiveComponentIndex(unsigned)
returns the index of "active" component
Definition: blackoilonephaseindices.hh:173
static const int contiBrineEqIdx
Index of the continuity equation for the salt component.
Definition: blackoilonephaseindices.hh:236
static const int contiMicrobialEqIdx
Index of the continuity equation for the first MICP component.
Definition: blackoilonephaseindices.hh:212
static const bool waterEnabled
Definition: blackoilonephaseindices.hh:45
static const int numExtbos
Number of components to be considered for extbo.
Definition: blackoilonephaseindices.hh:67
static const int zFractionIdx
Index of the primary variable for the first extbo component.
Definition: blackoilonephaseindices.hh:125
static const int numBrine
Number of salt equations to be considered.
Definition: blackoilonephaseindices.hh:79
static const bool gasEnabled
Definition: blackoilonephaseindices.hh:46
static const int compositionSwitchIdx
Index of the switching variable which determines the composition of the hydrocarbon phases.
Definition: blackoilonephaseindices.hh:118
static const int contiEnergyEqIdx
Index of the continuity equation for energy.
Definition: blackoilonephaseindices.hh:240
static const int foamConcentrationIdx
Index of the primary variable for the foam.
Definition: blackoilonephaseindices.hh:157
static const int contiCalciteEqIdx
Index of the continuity equation for the fifth MICP component.
Definition: blackoilonephaseindices.hh:228
static const int contiBiofilmEqIdx
Index of the continuity equation for the fourth MICP component.
Definition: blackoilonephaseindices.hh:224
static const bool enableExtbo
Is extbo invoked?
Definition: blackoilonephaseindices.hh:52
static const int polymerConcentrationIdx
Index of the primary variable for the first polymer.
Definition: blackoilonephaseindices.hh:129
static const int numEq
The number of equations.
Definition: blackoilonephaseindices.hh:88
static const int temperatureIdx
Index of the primary variable for temperature.
Definition: blackoilonephaseindices.hh:165
static const int contiUreaEqIdx
Index of the continuity equation for the third MICP component.
Definition: blackoilonephaseindices.hh:220
static const int contiPolymerEqIdx
Index of the continuity equation for the first polymer component.
Definition: blackoilonephaseindices.hh:204
static const int oxygenConcentrationIdx
Index of the primary variable for the second MICP component.
Definition: blackoilonephaseindices.hh:141
static const int microbialConcentrationIdx
Index of the primary variable for the first MICP component.
Definition: blackoilonephaseindices.hh:137
static const int numFoam
Number of foam equations to be considered.
Definition: blackoilonephaseindices.hh:76
static const bool enableSolvent
Are solvents involved?
Definition: blackoilonephaseindices.hh:49
static const int numEnergy
Number of energy equations to be considered.
Definition: blackoilonephaseindices.hh:73
static const int contiZfracEqIdx
Index of the continuity equation for the first extbo component.
Definition: blackoilonephaseindices.hh:200
static const int numSolvents
Number of solvent components to be considered.
Definition: blackoilonephaseindices.hh:64
static const int contiOxygenEqIdx
Index of the continuity equation for the second MICP component.
Definition: blackoilonephaseindices.hh:216
static const int conti0EqIdx
Index of the continuity equation of the first (and only) phase.
Definition: blackoilonephaseindices.hh:193
static const bool oilEnabled
Is phase enabled or not.
Definition: blackoilonephaseindices.hh:44
static const int polymerMoleWeightIdx
Index of the primary variable for the second polymer primary variable (molecular weight)
Definition: blackoilonephaseindices.hh:133
static const bool enablePolymer
Are polymers involved?
Definition: blackoilonephaseindices.hh:55
static const int numMICPs
Number of MICP components to be considered.
Definition: blackoilonephaseindices.hh:85