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 
33 namespace Ewoms {
34 
40 template <unsigned numSolventsV, unsigned numPolymersV, unsigned PVOffset, unsigned disabledCanonicalCompIdx>
42 {
43 
45  static const bool oilEnabled = disabledCanonicalCompIdx==0? false:true;
46  static const bool waterEnabled = disabledCanonicalCompIdx==1? false:true;
47  static const bool gasEnabled = disabledCanonicalCompIdx==2? false:true;
48 
50  static const int numPhases = 2;
51 
53  static const int numSolvents = numSolventsV;
54 
56  static const int numPolymers = numPolymersV;
57 
59  static const int numEq = numPhases + numSolvents + numPolymers;
60 
62  // Primary variable indices
64 
66  static const int waterSaturationIdx = waterEnabled ? PVOffset + 0: -10000;
67 
69  static const int pressureSwitchIdx = PVOffset + 1;
70 
77  static const int compositionSwitchIdx = gasEnabled ? PVOffset + 0: -10000;
78 
80  static const int solventSaturationIdx = PVOffset + numPhases;
81 
84 
85  // numSolvents-1 primary variables follow
86 
87 
89  // Equation indices
92  static unsigned canonicalToActiveComponentIndex(unsigned compIdx)
93  {
94  // assumes canonical oil = 0, water = 1, gas = 2;
95  if(!gasEnabled) {
96  assert(compIdx != 2);
97  // oil = 0, water = 1
98  return compIdx;
99  } else if (!waterEnabled) {
100  assert(compIdx != 1);
101  // oil = 0, gas = 1
102  return compIdx / 2;
103  } else {
104  assert(!oilEnabled);
105  assert(compIdx != 0);
106  }
107  // water = 0, gas = 1;
108  return compIdx-1;
109  }
110 
112  static const int conti0EqIdx = PVOffset + 0;
113  // two continuity equations follow
114 
116  static const int contiSolventEqIdx = PVOffset + numPhases - 1 + numSolvents;
117 
120  // numSolvents-1 continuity equations follow
121 
122 };
123 
124 } // namespace Ewoms
125 
126 #endif
static const int solventSaturationIdx
Index of the primary variable for the first solvent.
Definition: blackoiltwophaseindices.hh:80
static const int compositionSwitchIdx
Index of the switching variable which determines the composition of the hydrocarbon phases...
Definition: blackoiltwophaseindices.hh:77
static const int contiSolventEqIdx
Index of the continuity equation for the first solvent component.
Definition: blackoiltwophaseindices.hh:116
Definition: baseauxiliarymodule.hh:37
static const int pressureSwitchIdx
Index of the oil pressure in a vector of primary variables.
Definition: blackoiltwophaseindices.hh:69
static const int contiPolymerEqIdx
Index of the continuity equation for the first polymer component.
Definition: blackoiltwophaseindices.hh:119
static unsigned canonicalToActiveComponentIndex(unsigned compIdx)
returns the index of "active" component
Definition: blackoiltwophaseindices.hh:92
static const int numEq
The number of equations.
Definition: blackoiltwophaseindices.hh:59
static const int numPhases
Number of phases active at all times.
Definition: blackoiltwophaseindices.hh:50
static const int numSolvents
Number of solvent components considered.
Definition: blackoiltwophaseindices.hh:53
static const int numPolymers
Number of polymer components considered.
Definition: blackoiltwophaseindices.hh:56
The primary variable and equation indices for the black-oil model.
Definition: blackoiltwophaseindices.hh:41
static const bool oilEnabled
Is phase enabled or not.
Definition: blackoiltwophaseindices.hh:45
static const int waterSaturationIdx
The index of the water saturation. For two-phase oil gas models this is disabled. ...
Definition: blackoiltwophaseindices.hh:66
static const int polymerConcentrationIdx
Index of the primary variable for the first polymer.
Definition: blackoiltwophaseindices.hh:83
static const int conti0EqIdx
Index of the continuity equation of the first phase.
Definition: blackoiltwophaseindices.hh:112