opm-simulators
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 <opm/common/utility/ConstexprAssert.hpp>
32 
33 #include <cassert>
34 
35 namespace Opm {
36 
42 template<unsigned numSolventsV,
43  unsigned numExtbosV,
44  unsigned numPolymersV,
45  unsigned numEnergyV,
46  bool enableFoam,
47  bool enableBrine,
48  int PVOffset,
49  unsigned disabledCanonicalCompIdx,
50  unsigned numBioCompV>
52 {
54  static constexpr bool oilEnabled = disabledCanonicalCompIdx != 0;
55  static constexpr bool waterEnabled = disabledCanonicalCompIdx != 1;
56  static constexpr bool gasEnabled = disabledCanonicalCompIdx != 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 enableFullyImplicitThermal = numEnergyV > 0;
69 
71  static constexpr bool enableMICP = false;
72 
74  static constexpr bool enableBiofilm = numBioCompV > 0;
75 
77  static constexpr int numSolvents = enableSolvent ? numSolventsV : 0;
78 
80  static constexpr int numExtbos = enableExtbo ? numExtbosV : 0;
81 
83  static constexpr int numPolymers = enablePolymer ? numPolymersV : 0;
84 
86  static constexpr int numEnergy = enableFullyImplicitThermal ? numEnergyV : 0;
87 
89  static constexpr int numFoam = enableFoam? 1 : 0;
90 
92  static constexpr int numBrine = enableBrine? 1 : 0;
93 
95  static constexpr int numBioComp = enableBiofilm ? numBioCompV : 0;
96 
98  static constexpr int numBioInWat = enableBiofilm ? 1 : 0;
99 
101  static constexpr int numPhases = 2;
102 
104  static constexpr int numEq = numPhases + numSolvents + numExtbos + numPolymers +
106 
108  static constexpr int numDerivatives = numEq;
109 
111  // Primary variable indices
113 
122  static constexpr int waterSwitchIdx = waterEnabled ? PVOffset + 0 : -10000;
123 
130  static constexpr int pressureSwitchIdx = waterEnabled ? PVOffset + 1 : PVOffset + 0;
131 
138  static constexpr int compositionSwitchIdx = (gasEnabled && oilEnabled) ? PVOffset + 1 : -10000;
139 
141  static constexpr int solventSaturationIdx =
142  enableSolvent ? PVOffset + numPhases : -1000;
143 
145  static constexpr int zFractionIdx =
146  enableExtbo ? PVOffset + numPhases + numSolvents : -1000;
147 
149  static constexpr int polymerConcentrationIdx =
150  enablePolymer ? PVOffset + numPhases + numSolvents : -1000;
151 
153  static constexpr int polymerMoleWeightIdx =
154  numPolymers > 1 ? polymerConcentrationIdx + 1 : -1000;
155 
157  static constexpr int microbialConcentrationIdx =
158  enableBiofilm ? PVOffset + numPhases + numSolvents : -1000;
159 
161  static constexpr int biofilmVolumeFractionIdx =
162  enableBiofilm ? PVOffset + numPhases + numSolvents + 1 : -1000;
163 
165  static constexpr int oxygenConcentrationIdx = -1000;
166  static constexpr int ureaConcentrationIdx = -1000;
167  static constexpr int calciteVolumeFractionIdx = -1000;
168 
170  static constexpr int foamConcentrationIdx =
171  enableFoam ? PVOffset + numPhases + numSolvents + numPolymers + numBioComp : -1000;
172 
174  static constexpr int saltConcentrationIdx =
175  enableBrine ? PVOffset + numPhases + numSolvents + numPolymers + numBioComp + numFoam : -1000;
176 
178  static constexpr int temperatureIdx =
180 
182  // Equation indices
184 
186  static constexpr int conti0EqIdx = PVOffset + 0;
187  // one continuity equation follows
188 
190  static constexpr int contiSolventEqIdx =
191  enableSolvent ? PVOffset + numPhases : -1000;
192 
194  static constexpr int contiZfracEqIdx =
195  enableExtbo ? PVOffset + numPhases + numSolvents : -1000;
196 
198  static constexpr int contiPolymerEqIdx =
199  enablePolymer ? PVOffset + numPhases + numSolvents : -1000;
200 
202  static constexpr int contiPolymerMWEqIdx =
203  numPolymers > 1 ? contiPolymerEqIdx + 1 : -1000;
204 
206  static constexpr int contiMicrobialEqIdx =
207  enableBiofilm ? PVOffset + numPhases + numSolvents : -1000;
208 
210  static constexpr int contiBiofilmEqIdx =
211  enableBiofilm ? PVOffset + numPhases + numSolvents + 1 : -1000;
212 
214  static constexpr int contiOxygenEqIdx = -1000;
215  static constexpr int contiUreaEqIdx = -1000;
216  static constexpr int contiCalciteEqIdx = -1000;
217 
219  static constexpr int contiFoamEqIdx =
220  enableFoam ? PVOffset + numPhases + numSolvents + numPolymers + numBioComp : -1000;
221 
223  static constexpr int contiBrineEqIdx =
224  enableBrine ? PVOffset + numPhases + numSolvents + numPolymers + numBioComp + numFoam : -1000;
225 
227  static constexpr int contiEnergyEqIdx =
229 };
230 
231 } // namespace Opm
232 
233 #endif
static constexpr int oxygenConcentrationIdx
MICP only available for one phase indices.
Definition: blackoiltwophaseindices.hh:165
static constexpr int contiEnergyEqIdx
Index of the continuity equation for energy.
Definition: blackoiltwophaseindices.hh:227
static constexpr bool enableBiofilm
Are biofilms involved?
Definition: blackoiltwophaseindices.hh:74
static constexpr int polymerMoleWeightIdx
Index of the primary variable for the second polymer primary variable (molecular weight) ...
Definition: blackoiltwophaseindices.hh:153
static constexpr int numEnergy
Number of energy equations to be considered.
Definition: blackoiltwophaseindices.hh:86
static constexpr int microbialConcentrationIdx
Index of the primary variable for the first microbial component.
Definition: blackoiltwophaseindices.hh:157
static constexpr int numBrine
Number of salt equations to be considered.
Definition: blackoiltwophaseindices.hh:92
static constexpr bool enableSolvent
Are solvents involved?
Definition: blackoiltwophaseindices.hh:59
static constexpr int compositionSwitchIdx
Index of the switching variable which determines the composition of the hydrocarbon phases...
Definition: blackoiltwophaseindices.hh:138
static constexpr int contiPolymerEqIdx
Index of the continuity equation for the first polymer component.
Definition: blackoiltwophaseindices.hh:198
static constexpr int contiPolymerMWEqIdx
Index of the continuity equation for the second polymer component (molecular weight) ...
Definition: blackoiltwophaseindices.hh:202
static constexpr int temperatureIdx
Index of the primary variable for temperature.
Definition: blackoiltwophaseindices.hh:178
static constexpr int saltConcentrationIdx
Index of the primary variable for the salt.
Definition: blackoiltwophaseindices.hh:174
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
static constexpr bool enableMICP
MICP only available for one phase indices.
Definition: blackoiltwophaseindices.hh:71
The primary variable and equation indices for the black-oil model.
Definition: blackoiltwophaseindices.hh:51
static constexpr int solventSaturationIdx
Index of the primary variable for the first solvent.
Definition: blackoiltwophaseindices.hh:141
static constexpr int conti0EqIdx
Index of the continuity equation of the first phase.
Definition: blackoiltwophaseindices.hh:186
static constexpr bool enableFullyImplicitThermal
Shall energy be conserved?
Definition: blackoiltwophaseindices.hh:68
static constexpr int contiBrineEqIdx
Index of the continuity equation for the salt component.
Definition: blackoiltwophaseindices.hh:223
static constexpr int numDerivatives
We may want to evaluate with more derivatives that equations, but not this time.
Definition: blackoiltwophaseindices.hh:108
static constexpr int waterSwitchIdx
Index of the switching variable which determines the composistion of the water phase.
Definition: blackoiltwophaseindices.hh:122
static constexpr int numPhases
The number of fluid phases.
Definition: blackoiltwophaseindices.hh:101
static constexpr int numSolvents
Number of solvent components to be considered.
Definition: blackoiltwophaseindices.hh:77
static constexpr int biofilmVolumeFractionIdx
Index of the primary variable for the biofilm component.
Definition: blackoiltwophaseindices.hh:161
static constexpr bool enablePolymer
Are polymers involved?
Definition: blackoiltwophaseindices.hh:65
static constexpr int numEq
The number of equations.
Definition: blackoiltwophaseindices.hh:104
static constexpr int zFractionIdx
Index of the primary variable for the first extbo component.
Definition: blackoiltwophaseindices.hh:145
static constexpr int contiBiofilmEqIdx
Index of the continuity equation for the biofilm component.
Definition: blackoiltwophaseindices.hh:210
static constexpr bool enableExtbo
Is extbo invoked?
Definition: blackoiltwophaseindices.hh:62
static constexpr int contiZfracEqIdx
Index of the continuity equation for the first extbo component.
Definition: blackoiltwophaseindices.hh:194
static constexpr int numBioInWat
Number of biocomponents in the water phase.
Definition: blackoiltwophaseindices.hh:98
static constexpr int polymerConcentrationIdx
Index of the primary variable for the first polymer.
Definition: blackoiltwophaseindices.hh:149
static constexpr int numBioComp
Number of biofilm equations to be considered.
Definition: blackoiltwophaseindices.hh:95
static constexpr int foamConcentrationIdx
Index of the primary variable for the foam.
Definition: blackoiltwophaseindices.hh:170
static constexpr int contiSolventEqIdx
Index of the continuity equation for the first solvent component.
Definition: blackoiltwophaseindices.hh:190
static constexpr int contiOxygenEqIdx
MICP only available for one phase indices.
Definition: blackoiltwophaseindices.hh:214
static constexpr int numExtbos
Number of components to be considered for extbo.
Definition: blackoiltwophaseindices.hh:80
static constexpr int numPolymers
Number of polymer components to be considered.
Definition: blackoiltwophaseindices.hh:83
static constexpr bool oilEnabled
Is phase enabled or not.
Definition: blackoiltwophaseindices.hh:54
static constexpr int contiFoamEqIdx
Index of the continuity equation for the foam component.
Definition: blackoiltwophaseindices.hh:219
static constexpr int contiMicrobialEqIdx
Index of the continuity equation for the first microbial component.
Definition: blackoiltwophaseindices.hh:206
static constexpr int pressureSwitchIdx
Index of the switching variable which determines the pressure.
Definition: blackoiltwophaseindices.hh:130
static constexpr int numFoam
Number of foam equations to be considered.
Definition: blackoiltwophaseindices.hh:89