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  Copyright (C) 2013 by Andreas Lauser
5 
6  This file is part of the Open Porous Media project (OPM).
7 
8  OPM is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 2 of the License, or
11  (at your option) any later version.
12 
13  OPM is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with OPM. If not, see <http://www.gnu.org/licenses/>.
20 */
29 #ifndef OPM_MATERIAL_TRAITS_HPP
30 #define OPM_MATERIAL_TRAITS_HPP
31 
32 namespace Opm {
40 template <class ScalarT, int numPhasesV>
42 {
43 public:
45  typedef ScalarT Scalar;
46 
48  static const int numPhases = numPhasesV;
49 };
50 
56 template <class ScalarT, int wettingPhaseIdxV, int nonWettingPhaseIdxV>
58 {
59 public:
61  typedef ScalarT Scalar;
62 
64  static const int numPhases = 2;
65 
67  static const int wettingPhaseIdx = wettingPhaseIdxV;
68 
70  static const int nonWettingPhaseIdx = nonWettingPhaseIdxV;
71 
72  // some safety checks...
73  static_assert(wettingPhaseIdx != nonWettingPhaseIdx,
74  "wettingPhaseIdx and nonWettingPhaseIdx must be different");
75 };
76 
82 template <class ScalarT, int wettingPhaseIdxV, int nonWettingasPhaseIdxV, int gasPhaseIdxV>
84 {
85 public:
87  typedef ScalarT Scalar;
88 
90  static const int numPhases = 3;
91 
93  static const int wettingPhaseIdx = wettingPhaseIdxV;
94 
96  static const int nonWettingPhaseIdx = nonWettingasPhaseIdxV;
97 
99  static const int gasPhaseIdx = gasPhaseIdxV;
100 
101  // some safety checks...
102  static_assert(0 <= wettingPhaseIdx && wettingPhaseIdx < numPhases,
103  "wettingPhaseIdx is out of range");
104  static_assert(0 <= nonWettingPhaseIdx && nonWettingPhaseIdx < numPhases,
105  "nonWettingPhaseIdx is out of range");
106  static_assert(0 <= gasPhaseIdx && gasPhaseIdx < numPhases,
107  "gasPhaseIdx is out of range");
108 
109  static_assert(wettingPhaseIdx != nonWettingPhaseIdx,
110  "wettingPhaseIdx and nonWettingPhaseIdx must be different");
111  static_assert(wettingPhaseIdx != gasPhaseIdx,
112  "wettingPhaseIdx and gasPhaseIdx must be different");
113  static_assert(nonWettingPhaseIdx != gasPhaseIdx,
114  "nonWettingPhaseIdx and gasPhaseIdx must be different");
115 };
116 } // namespace Opm
117 
118 #endif
static const int numPhases
The number of fluid phases.
Definition: MaterialTraits.hpp:64
Definition: Air_Mesitylene.hpp:31
ScalarT Scalar
The type used for scalar floating point values.
Definition: MaterialTraits.hpp:61
A generic traits class which does not provide any indices.
Definition: MaterialTraits.hpp:41
static const int numPhases
The number of fluid phases.
Definition: MaterialTraits.hpp:90
ScalarT Scalar
The type used for scalar floating point values.
Definition: MaterialTraits.hpp:87
static const int numPhases
The number of fluid phases.
Definition: MaterialTraits.hpp:48
A generic traits class for three-phase material laws.
Definition: MaterialTraits.hpp:83
ScalarT Scalar
The type used for scalar floating point values.
Definition: MaterialTraits.hpp:45
static const int wettingPhaseIdx
The index of the wetting phase.
Definition: MaterialTraits.hpp:67
A generic traits class for two-phase material laws.
Definition: MaterialTraits.hpp:57
static const int gasPhaseIdx
The index of the gas phase (i.e., the least wetting phase)
Definition: MaterialTraits.hpp:99
static const int nonWettingPhaseIdx
The index of the non-wetting phase.
Definition: MaterialTraits.hpp:70
static const int wettingPhaseIdx
The index of the wetting liquid phase.
Definition: MaterialTraits.hpp:93
static const int nonWettingPhaseIdx
The index of the non-wetting liquid phase.
Definition: MaterialTraits.hpp:96