opm-simulators
blackoilvariableandequationindices.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 OPM_BLACK_OIL_VARIABLE_AND_EQUATION_INDICES_HH
29 #define OPM_BLACK_OIL_VARIABLE_AND_EQUATION_INDICES_HH
30 
31 #include <limits>
32 
33 namespace Opm {
34 
40 template<unsigned numSolventsV,
41  unsigned numExtbosV,
42  unsigned numPolymersV,
43  unsigned numEnergyV,
44  bool enableFoam,
45  bool enableBrine,
46  int PVOffset,
47  unsigned numBioCompV>
49 {
51  static constexpr int numPhases = 3;
52 
54  static constexpr bool oilEnabled = true;
55  static constexpr bool waterEnabled = true;
56  static constexpr bool gasEnabled = true;
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 enableFullyImplicitThermal = numEnergyV > 0;
69 
71  static constexpr bool enableMICP = false;
72  static constexpr bool enableBiofilm = false;
73  static constexpr int numBioInWat = 0;
74 
76  static constexpr int numSolvents = enableSolvent ? numSolventsV : 0;
77 
79  static constexpr int numExtbos = enableExtbo ? numExtbosV : 0;
80 
82  static constexpr int numPolymers = enablePolymer ? numPolymersV : 0;
83 
85  static constexpr int numEnergy = enableFullyImplicitThermal ? numEnergyV : 0;
86 
88  static constexpr int numFoam = enableFoam? 1 : 0;
89 
91  static constexpr int numBrine = enableBrine? 1 : 0;
92 
94  static constexpr int numEq = numPhases + numSolvents + numExtbos + numPolymers +
96 
98  static constexpr int numDerivatives = numEq;
99 
100 
102  // Primary variable indices
104 
111  static constexpr unsigned waterSwitchIdx = PVOffset + 0;
112 
119  static constexpr unsigned pressureSwitchIdx = PVOffset + 1;
120 
129  static constexpr unsigned compositionSwitchIdx = PVOffset + 2;
130 
132  static constexpr unsigned solventSaturationIdx =
133  enableSolvent ? PVOffset + numPhases
134  : std::numeric_limits<unsigned>::max();
135 
137  static constexpr unsigned zFractionIdx =
138  enableExtbo ? PVOffset + numPhases + numSolvents
139  : std::numeric_limits<unsigned>::max();
140 
142  static constexpr unsigned polymerConcentrationIdx =
143  enablePolymer ? PVOffset + numPhases + numSolvents
144  : std::numeric_limits<unsigned>::max();
145 
147  static constexpr unsigned polymerMoleWeightIdx =
149  : std::numeric_limits<unsigned>::max();
150 
152  static constexpr unsigned microbialConcentrationIdx = std::numeric_limits<unsigned>::max();
153  static constexpr unsigned oxygenConcentrationIdx = std::numeric_limits<unsigned>::max();
154  static constexpr unsigned ureaConcentrationIdx = std::numeric_limits<unsigned>::max();
155  static constexpr unsigned biofilmVolumeFractionIdx = std::numeric_limits<unsigned>::max();
156  static constexpr unsigned calciteVolumeFractionIdx = std::numeric_limits<unsigned>::max();
157 
159  static constexpr unsigned foamConcentrationIdx =
160  enableFoam ? PVOffset + numPhases + numSolvents + numExtbos + numPolymers
161  : std::numeric_limits<unsigned>::max();
162 
164  static constexpr unsigned saltConcentrationIdx =
165  enableBrine ? PVOffset + numPhases + numSolvents + numExtbos + numPolymers + numFoam
166  : std::numeric_limits<unsigned>::max();
167 
169  static constexpr unsigned temperatureIdx =
172  : std::numeric_limits<unsigned>::max();
173 
174 
176  // Equation indices
178 
180  static constexpr int conti0EqIdx = PVOffset + 0;
181  // two continuity equations follow
182 
184  static constexpr int contiSolventEqIdx =
185  enableSolvent ? PVOffset + numPhases : -1000;
186 
188  static constexpr int contiZfracEqIdx =
189  enableExtbo ? PVOffset + numPhases + numSolvents : -1000;
190 
192  static constexpr int contiPolymerEqIdx =
193  enablePolymer ? PVOffset + numPhases + numSolvents + numExtbos : -1000;
194 
196  static constexpr int contiPolymerMWEqIdx =
197  numPolymers > 1 ? contiPolymerEqIdx + 1 : -1000;
198 
200  static constexpr int contiMicrobialEqIdx = -1000;
201  static constexpr int contiOxygenEqIdx = -1000;
202  static constexpr int contiUreaEqIdx = -1000;
203  static constexpr int contiBiofilmEqIdx = -1000;
204  static constexpr int contiCalciteEqIdx = -1000;
205 
207  static constexpr int contiFoamEqIdx =
208  enableFoam ? PVOffset + numPhases + numSolvents + numExtbos + numPolymers : -1000;
209 
211  static constexpr int contiBrineEqIdx =
212  enableBrine ? PVOffset + numPhases + numSolvents + numExtbos + numPolymers + numFoam : -1000;
213 
215  static constexpr int contiEnergyEqIdx =
217 };
218 
219 } // namespace Opm
220 
221 #endif
static constexpr unsigned microbialConcentrationIdx
No bioeffects for three phase indices.
Definition: blackoilvariableandequationindices.hh:152
static constexpr bool enablePolymer
Are polymers involved?
Definition: blackoilvariableandequationindices.hh:65
static constexpr int contiPolymerMWEqIdx
Index of the continuity equation for the second polymer component (molecular weight) ...
Definition: blackoilvariableandequationindices.hh:196
static constexpr unsigned saltConcentrationIdx
Index of the primary variable for the brine.
Definition: blackoilvariableandequationindices.hh:164
static constexpr int numFoam
Number of foam equations to be considered.
Definition: blackoilvariableandequationindices.hh:88
static constexpr unsigned solventSaturationIdx
Index of the primary variable for the first solvent.
Definition: blackoilvariableandequationindices.hh:132
static constexpr int contiMicrobialEqIdx
No bioeffects for three phase indices.
Definition: blackoilvariableandequationindices.hh:200
static constexpr int contiBrineEqIdx
Index of the continuity equation for the salt water component.
Definition: blackoilvariableandequationindices.hh:211
static constexpr unsigned temperatureIdx
Index of the primary variable for temperature.
Definition: blackoilvariableandequationindices.hh:169
static constexpr bool enableSolvent
Are solvents involved?
Definition: blackoilvariableandequationindices.hh:59
static constexpr bool enableFullyImplicitThermal
Shall energy be conserved?
Definition: blackoilvariableandequationindices.hh:68
static constexpr bool oilEnabled
All phases are enabled.
Definition: blackoilvariableandequationindices.hh:54
static constexpr int numSolvents
Number of solvent components to be considered.
Definition: blackoilvariableandequationindices.hh:76
static constexpr int contiFoamEqIdx
Index of the continuity equation for the foam component.
Definition: blackoilvariableandequationindices.hh:207
static constexpr unsigned polymerConcentrationIdx
Index of the primary variable for the first polymer.
Definition: blackoilvariableandequationindices.hh:142
Structs needed for tpfalinearizer and its gpuparams struct extracted to be defined in one place that ...
Definition: blackoilbioeffectsmodules.hh:45
static constexpr unsigned polymerMoleWeightIdx
Index of the primary variable for the second polymer primary variable (molecular weight) ...
Definition: blackoilvariableandequationindices.hh:147
The primary variable and equation indices for the three-phase black-oil model.
Definition: blackoilvariableandequationindices.hh:48
static constexpr unsigned waterSwitchIdx
Index of the switching variable which determines the composistion of the water phase.
Definition: blackoilvariableandequationindices.hh:111
static constexpr int contiSolventEqIdx
Index of the continuity equation for the first solvent component.
Definition: blackoilvariableandequationindices.hh:184
static constexpr int numExtbos
Number of components to be considered for extbo.
Definition: blackoilvariableandequationindices.hh:79
static constexpr int numDerivatives
We may want to evaluate with more derivatives that equations, but not this time.
Definition: blackoilvariableandequationindices.hh:98
static constexpr int numBrine
Number of salt equations to be considered.
Definition: blackoilvariableandequationindices.hh:91
static constexpr int contiPolymerEqIdx
Index of the continuity equation for the first polymer component.
Definition: blackoilvariableandequationindices.hh:192
static constexpr unsigned zFractionIdx
Index of the primary variable for the first extbo component.
Definition: blackoilvariableandequationindices.hh:137
static constexpr int numEnergy
Number of energy equations to be considered.
Definition: blackoilvariableandequationindices.hh:85
static constexpr int contiZfracEqIdx
Index of the continuity equation for the first extbo component.
Definition: blackoilvariableandequationindices.hh:188
static constexpr unsigned compositionSwitchIdx
Index of the switching variable which determines the composition of the hydrocarbon phases...
Definition: blackoilvariableandequationindices.hh:129
static constexpr bool enableMICP
No bioeffects for three phase indices.
Definition: blackoilvariableandequationindices.hh:71
static constexpr int numPolymers
Number of polymer components to be considered.
Definition: blackoilvariableandequationindices.hh:82
static constexpr unsigned foamConcentrationIdx
Index of the primary variable for the foam.
Definition: blackoilvariableandequationindices.hh:159
static constexpr int contiEnergyEqIdx
Index of the continuity equation for energy.
Definition: blackoilvariableandequationindices.hh:215
static constexpr unsigned pressureSwitchIdx
Index of the switching variable which determines the pressure.
Definition: blackoilvariableandequationindices.hh:119
static constexpr int numPhases
Number of phases active at all times.
Definition: blackoilvariableandequationindices.hh:51
static constexpr int conti0EqIdx
Index of the continuity equation of the first phase.
Definition: blackoilvariableandequationindices.hh:180
static constexpr bool enableExtbo
Is extbo invoked?
Definition: blackoilvariableandequationindices.hh:62
static constexpr int numEq
The number of equations.
Definition: blackoilvariableandequationindices.hh:94