MaterialTraits.hpp
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 */
31 #ifndef OPM_MATERIAL_TRAITS_HPP
32 #define OPM_MATERIAL_TRAITS_HPP
33 
34 namespace Opm {
42 template <class ScalarT, int numPhasesV>
44 {
45 public:
47  typedef ScalarT Scalar;
48 
50  static const int numPhases = numPhasesV;
51 };
52 
58 template <class ScalarT, int wettingPhaseIdxV, int nonWettingPhaseIdxV>
60 {
61 public:
63  typedef ScalarT Scalar;
64 
66  static const int numPhases = 2;
67 
69  static const int wettingPhaseIdx = wettingPhaseIdxV;
70 
72  static const int nonWettingPhaseIdx = nonWettingPhaseIdxV;
73 
74  // some safety checks...
75  static_assert(wettingPhaseIdx != nonWettingPhaseIdx,
76  "wettingPhaseIdx and nonWettingPhaseIdx must be different");
77 };
78 
84 template <class ScalarT, int wettingPhaseIdxV, int nonWettingasPhaseIdxV, int gasPhaseIdxV>
86 {
87 public:
89  typedef ScalarT Scalar;
90 
92  static const int numPhases = 3;
93 
95  static const int wettingPhaseIdx = wettingPhaseIdxV;
96 
98  static const int nonWettingPhaseIdx = nonWettingasPhaseIdxV;
99 
101  static const int gasPhaseIdx = gasPhaseIdxV;
102 
103  // some safety checks...
104  static_assert(0 <= wettingPhaseIdx && wettingPhaseIdx < numPhases,
105  "wettingPhaseIdx is out of range");
106  static_assert(0 <= nonWettingPhaseIdx && nonWettingPhaseIdx < numPhases,
107  "nonWettingPhaseIdx is out of range");
108  static_assert(0 <= gasPhaseIdx && gasPhaseIdx < numPhases,
109  "gasPhaseIdx is out of range");
110 
111  static_assert(wettingPhaseIdx != nonWettingPhaseIdx,
112  "wettingPhaseIdx and nonWettingPhaseIdx must be different");
113  static_assert(wettingPhaseIdx != gasPhaseIdx,
114  "wettingPhaseIdx and gasPhaseIdx must be different");
115  static_assert(nonWettingPhaseIdx != gasPhaseIdx,
116  "nonWettingPhaseIdx and gasPhaseIdx must be different");
117 };
118 } // namespace Opm
119 
120 #endif
A generic traits class for three-phase material laws.
Definition: MaterialTraits.hpp:85
static const int numPhases
The number of fluid phases.
Definition: MaterialTraits.hpp:66
static const int nonWettingPhaseIdx
The index of the non-wetting liquid phase.
Definition: MaterialTraits.hpp:98
ScalarT Scalar
The type used for scalar floating point values.
Definition: MaterialTraits.hpp:47
Definition: Air_Mesitylene.hpp:33
static const int wettingPhaseIdx
The index of the wetting liquid phase.
Definition: MaterialTraits.hpp:95
ScalarT Scalar
The type used for scalar floating point values.
Definition: MaterialTraits.hpp:89
A generic traits class which does not provide any indices.
Definition: MaterialTraits.hpp:43
ScalarT Scalar
The type used for scalar floating point values.
Definition: MaterialTraits.hpp:63
static const int numPhases
The number of fluid phases.
Definition: MaterialTraits.hpp:92
static const int nonWettingPhaseIdx
The index of the non-wetting phase.
Definition: MaterialTraits.hpp:72
static const int numPhases
The number of fluid phases.
Definition: MaterialTraits.hpp:50
static const int gasPhaseIdx
The index of the gas phase (i.e., the least wetting phase)
Definition: MaterialTraits.hpp:101
A generic traits class for two-phase material laws.
Definition: MaterialTraits.hpp:59
static const int wettingPhaseIdx
The index of the wetting phase.
Definition: MaterialTraits.hpp:69