BlackoilPhases.hpp
Go to the documentation of this file.
1/*
2 Copyright 2010, 2011, 2012 SINTEF ICT, Applied Mathematics.
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 3 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
20#ifndef OPM_BLACKOILPHASES_HEADER_INCLUDED
21#define OPM_BLACKOILPHASES_HEADER_INCLUDED
22
23
24namespace Opm
25{
26
28 {
29 public:
30 static const int MaxNumPhases = 3;
31
32 // "Crypto phases" are "phases" (or rather "conservation quantities") in the
33 // sense that they can be active or not and canonical indices can be translated
34 // to and from active ones. That said, they are not considered by num_phases or
35 // MaxNumPhases. The crypto phases which are currently implemented are solvent,
36 // polymer and energy.
37 static const int NumCryptoPhases = 3;
38
39 // enum ComponentIndex { Water = 0, Oil = 1, Gas = 2 };
40 enum PhaseIndex { Aqua = 0, Liquid = 1, Vapour = 2, Solvent = 3, Polymer = 4, Energy = 5 };
41 };
42
43 struct PhaseUsage : public BlackoilPhases
44 {
51 };
52
59 {
60 public:
62 : present_(0)
63 {}
64
65 bool hasFreeWater() const { return present(BlackoilPhases::Aqua ); }
66 bool hasFreeOil () const { return present(BlackoilPhases::Liquid); }
67 bool hasFreeGas () const { return present(BlackoilPhases::Vapour); }
68
72
73 bool operator==(const PhasePresence& other) const { return present_ == other.present_; }
74 bool operator!=(const PhasePresence& other) const { return !this->operator==(other); }
75
76 private:
77 unsigned char present_;
78
79 bool present(const BlackoilPhases::PhaseIndex i) const
80 {
81 return present_ & (1 << i);
82 }
83
84 void insert(const BlackoilPhases::PhaseIndex i)
85 {
86 present_ |= (1 << i);
87 }
88 };
89
90} // namespace Opm
91
92#endif // OPM_BLACKOILPHASES_HEADER_INCLUDED
Definition: BlackoilPhases.hpp:28
static const int MaxNumPhases
Definition: BlackoilPhases.hpp:30
static const int NumCryptoPhases
Definition: BlackoilPhases.hpp:37
PhaseIndex
Definition: BlackoilPhases.hpp:40
@ Liquid
Definition: BlackoilPhases.hpp:40
@ Aqua
Definition: BlackoilPhases.hpp:40
@ Vapour
Definition: BlackoilPhases.hpp:40
@ Energy
Definition: BlackoilPhases.hpp:40
@ Solvent
Definition: BlackoilPhases.hpp:40
@ Polymer
Definition: BlackoilPhases.hpp:40
Definition: BlackoilPhases.hpp:59
void setFreeOil()
Definition: BlackoilPhases.hpp:70
bool operator!=(const PhasePresence &other) const
Definition: BlackoilPhases.hpp:74
PhasePresence()
Definition: BlackoilPhases.hpp:61
bool hasFreeGas() const
Definition: BlackoilPhases.hpp:67
bool hasFreeWater() const
Definition: BlackoilPhases.hpp:65
bool operator==(const PhasePresence &other) const
Definition: BlackoilPhases.hpp:73
void setFreeWater()
Definition: BlackoilPhases.hpp:69
bool hasFreeOil() const
Definition: BlackoilPhases.hpp:66
void setFreeGas()
Definition: BlackoilPhases.hpp:71
Definition: AnisotropicEikonal.hpp:44
Definition: BlackoilPhases.hpp:44
bool has_polymer
Definition: BlackoilPhases.hpp:49
bool has_energy
Definition: BlackoilPhases.hpp:50
int phase_pos[MaxNumPhases+NumCryptoPhases]
Definition: BlackoilPhases.hpp:47
int phase_used[MaxNumPhases+NumCryptoPhases]
Definition: BlackoilPhases.hpp:46
bool has_solvent
Definition: BlackoilPhases.hpp:48
int num_phases
Definition: BlackoilPhases.hpp:45