opm-common
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 {
35 
43 template <class ScalarT, int numPhasesV>
45 {
46 public:
48  using Scalar = ScalarT;
49 
51  static constexpr int numPhases = numPhasesV;
52 };
53 
59 template <class ScalarT, int wettingPhaseIdxV, int nonWettingPhaseIdxV>
61 {
62 public:
64  using Scalar = ScalarT;
65 
67  static constexpr int numPhases = 2;
68 
70  static constexpr int wettingPhaseIdx = wettingPhaseIdxV;
71 
73  static constexpr int nonWettingPhaseIdx = nonWettingPhaseIdxV;
74 
75  // some safety checks...
76  static_assert(wettingPhaseIdx != nonWettingPhaseIdx,
77  "wettingPhaseIdx and nonWettingPhaseIdx must be different");
78 };
79 
85 template <class ScalarT, int wettingPhaseIdxV, int nonWettingasPhaseIdxV, int gasPhaseIdxV,
86  bool enableHysteresisV, bool enableEndpointScalingV>
88 {
89 public:
91  using Scalar = ScalarT;
92 
94  static constexpr int numPhases = 3;
95 
97  static constexpr int wettingPhaseIdx = wettingPhaseIdxV;
98 
100  static constexpr int nonWettingPhaseIdx = nonWettingasPhaseIdxV;
101 
103  static constexpr int gasPhaseIdx = gasPhaseIdxV;
104 
106  static constexpr bool enableHysteresis = enableHysteresisV;
107 
109  static constexpr bool enableEndpointScaling = enableEndpointScalingV;
110 
111  // some safety checks...
112  static_assert(0 <= wettingPhaseIdx && wettingPhaseIdx < numPhases,
113  "wettingPhaseIdx is out of range");
114  static_assert(0 <= nonWettingPhaseIdx && nonWettingPhaseIdx < numPhases,
115  "nonWettingPhaseIdx is out of range");
116  static_assert(0 <= gasPhaseIdx && gasPhaseIdx < numPhases,
117  "gasPhaseIdx is out of range");
118 
119  static_assert(wettingPhaseIdx != nonWettingPhaseIdx,
120  "wettingPhaseIdx and nonWettingPhaseIdx must be different");
121  static_assert(wettingPhaseIdx != gasPhaseIdx,
122  "wettingPhaseIdx and gasPhaseIdx must be different");
123  static_assert(nonWettingPhaseIdx != gasPhaseIdx,
124  "nonWettingPhaseIdx and gasPhaseIdx must be different");
125 };
126 
127 } // namespace Opm
128 
129 #endif
A generic traits class for three-phase material laws.
Definition: MaterialTraits.hpp:87
ScalarT Scalar
The type used for scalar floating point values.
Definition: MaterialTraits.hpp:48
ScalarT Scalar
The type used for scalar floating point values.
Definition: MaterialTraits.hpp:64
static constexpr int numPhases
The number of fluid phases.
Definition: MaterialTraits.hpp:51
static constexpr int nonWettingPhaseIdx
The index of the non-wetting phase.
Definition: MaterialTraits.hpp:73
static constexpr int gasPhaseIdx
The index of the gas phase (i.e., the least wetting phase)
Definition: MaterialTraits.hpp:103
static constexpr int wettingPhaseIdx
The index of the wetting liquid phase.
Definition: MaterialTraits.hpp:97
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
static constexpr int wettingPhaseIdx
The index of the wetting phase.
Definition: MaterialTraits.hpp:70
A generic traits class which does not provide any indices.
Definition: MaterialTraits.hpp:44
static constexpr int nonWettingPhaseIdx
The index of the non-wetting liquid phase.
Definition: MaterialTraits.hpp:100
ScalarT Scalar
The type used for scalar floating point values.
Definition: MaterialTraits.hpp:91
static constexpr int numPhases
The number of fluid phases.
Definition: MaterialTraits.hpp:67
static constexpr bool enableHysteresis
Is hysteresis enabled.
Definition: MaterialTraits.hpp:106
static constexpr bool enableEndpointScaling
Is endpoint scaling enabled.
Definition: MaterialTraits.hpp:109
static constexpr int numPhases
The number of fluid phases.
Definition: MaterialTraits.hpp:94
A generic traits class for two-phase material laws.
Definition: MaterialTraits.hpp:60